Welcome to the Monastery | |
PerlMonks |
Re: Managing captureby LanX (Saint) |
on Feb 19, 2013 at 12:10 UTC ( [id://1019536]=note: print w/replies, xml ) | Need Help?? |
to answer the question "how do I pass a method as a callback" doSomething is evidently a method, so it gets my ($self,%args) =@_ in the first line. Now if you wanna call an anonymous method $args{on_succes}, do something like
Assure that the callback itself takes self again from the args! on_success => sub { my ($self,%args); }
Cheers Rolf UPDATE: sigh ... there is a parsing problem with $self->$args{on_succes}(ARG_LIST); You'll need to use a temporary var $code_ref
In Section
Seekers of Perl Wisdom
|
|