in reply to Re^2: How can I call a Perl sub with an object from a sub name stored in a var?
in thread How can I call a Perl sub with an object from a sub name stored in a var?

Define yourself a custom function to do your "approach".

I called it cryptic, guess why...

DB<170> sub cryptic { my ($func,$meth,$args) = @_ ; $func->()->$meth +(eval $args) } DB<171> x [$self,$mysub,$myargs] 0 ARRAY(0x3c46108) 0 'bla' 1 'test' 2 '$a,$b' DB<172> &$self->$mysub ( eval $myargs ) [bless({}, "TEMP"), 42, 666] DB<173> cryptic( 'bla' , 'test', '$a,$b' ) [bless({}, "TEMP"), 42, 666] DB<174>

you'll probably need to deactivate strict inside.

edit

and caller will tell you the name of the package from where you called cryptic()

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery