Hi,

I'm trying to tap into the NSDistributedNotificationCenter with Perl.

The simplest script that almost works is this:

#### START
package Listener;
use strict;
use Foundation;

sub start {
  my ($class) = @_;
  my $self = bless {}, $class;

  my $center = NSDistributedNotificationCenter->defaultCenter;
$center->addObserver_selector_name_object_($self, 'updated', "org.simplicidade.guy.whatsup", undef);
  NSRunLoop->currentRunLoop->run;
}

sub updated {}

package main;
use strict;

Listener->start;

#### END

I get the events but I cannot figure out how to pass a selector (the 'updated' argument in the addObserver... call above) from Perl to ObjC. I've also tried the following:

 * using base as PerlObjCBridge or NSObject;
 * using PerlObjCBridge::preloadSelectors('Listener');
 * using a anonymous coderef;
 * using a coderef to &updated.

The following messages are generated when the notification is received.

2008-03-12 10:14:11.710 perl[22003] *** -[PerlProxy updated]: selector not recognized [self = 0x3323c0] 2008-03-12 10:14:11.710 perl[22003] Exception raised during posting of notification. Ignored. exception: *** -[PerlProxy updated]: selector not recognized [self = 0x3323c0]

So the "updated" selector is recognized somehow, the then he uses a PerlProxy base class? I could not find any documentation on PerlProxy.

Any ideas on how to give a selector to objC?

Thanks in advance,
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: [EMAIL PROTECTED]
Use XMPP!


Reply via email to