in reply to Missing object reference in sub
Perl 5 doesn't make a strong distinction between subroutines and methods. The magic is really at the point of invocation, and that's whether you call the function as a method on an invocant or invoke it directly.
I don't know the particulars of this API, but if the methods are supposed to be callbacks, you may have to create a thunking closure that invokes the method on the object appropriately:
sum => sub { $obj->sum( @_ ) },
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Missing object reference in sub
by Lazarus (Novice) on Sep 26, 2007 at 20:13 UTC | |
by chromatic (Archbishop) on Sep 26, 2007 at 20:49 UTC | |
by almut (Canon) on Sep 26, 2007 at 21:10 UTC | |
by chromatic (Archbishop) on Sep 26, 2007 at 23:09 UTC | |
by Lazarus (Novice) on Sep 28, 2007 at 13:55 UTC | |
by almut (Canon) on Sep 26, 2007 at 20:46 UTC | |
by Lazarus (Novice) on Sep 28, 2007 at 14:04 UTC | |
by kyle (Abbot) on Sep 26, 2007 at 21:38 UTC | |
by almut (Canon) on Sep 26, 2007 at 22:10 UTC |