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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to