Re: PerlObjCBridge and SFAuthorization
Re: PerlObjCBridge and SFAuthorization
- Subject: Re: PerlObjCBridge and SFAuthorization
- From: Cameron Smith <email@hidden>
- Date: Fri, 13 Jun 2008 11:41:16 -0700
For those reading this later and hoping for an answer, I was unable to
find one and abandoned this approach shortly after the original post.
Instead I wrote my own Perl module in C and used the OpenDirectory and
Security frameworks to expose routines for authentication,
authorization and Open Directory record manipulation.
On Apr 29, 2008, at 13:59:50, Cameron Smith wrote:
Maybe I'm missing something fundamental, but I can't get this to
work. Based on what I've read, I should be able to use the
PerlObjCBridge to access the Security.framework through the
SFAuthorization class.
According to "man PerlObjCBridge":
"Using PerlObjCBridge, Perl programs can reference Objective-C
objects in a manner similar to references to native Perl objects.
The Objective-C objects must inherit from the NSObject root class in
the Mac OS X Foundation framework (which is true for Cocoa objects)."
According to the SFAuthorization Class Objective-C Reference:
"Inherits from NSObject"
Cobbling together bits and pieces from various sources, I came up
with this perl script:
---
#!/usr/bin/perl
use warnings;
use strict;
use Foundation;
PerlObjCBridge::setTracing(1);
my $frameworkPath = NSString->stringWithCString_('/System/Library/
Frameworks/Security.framework');
my $framework = NSBundle->alloc->init->initWithPath_($frameworkPath);
$framework->load() if $framework;
if ($framework->isLoaded) {
package SFAuthorization;
our @ISA = qw(PerlObjCBridge);
} else {
print STDERR "Cannot load Security framework\n";
exit 1;
}
my $auth = SFAuthorization->authorization;
---
On execution, I get the following error:
**** ERROR **** PerlObjCBridge: sendObjcMessage: Can't get class
object for class name SFAuthorization
The only reference I can find to that particular error is a couple
of messages that went through this list in 2005 (http://lists.apple.com/archives/Cocoa-dev/2005/Oct/msg00082.html
). But in that case, the original poster was trying to access the
NSSize struct, which is not a class. In this case, I'm referencing a
class and should be getting back an object:
authorization
Returns an authorization object.
+ (id)authorization
Can anyone give me an idea what's going wrong?
Cameron Smith
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Cameron Smith
Black Press IT
Black Press Group Ltd.
mailto:email@hidden
tel:604.803.0051
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden