Subject: | Rejecting non-references for no reason? |
I was trying to use Event::Notify in a situation where I wanted to
register packages, and have a class method called on them when the
notification fired, but it seems I can't do that because of this code in
Event::Notify->register_event:
if (! $ref) {
Carp::croak( "Non-ref observer passed. Expected an object or a
CODE ref"
);
}
Which prevents you from using Event::Notify in this way, for no apparent
reason. In fact if I just remove the croak, then it works just as I
would have expected it to....
my $notify = Event::Notify->new;
MyClass->register( $notify );