I don't quite get the compactness of $a->${$a->{f}}('foobar'); but maybe what you are loking for is to store a reference to the foo method instead of its name:
sub new { return bless {f => \&foo}, $_[0]; } # \&foo is a reference to foo()And then you can call the subroutine (including under use strict) as $a->{f}('foobar'); just note that in this case foo is just a regular function, not a method any more and you either have to remove the shift in the function or pass it $a.
In reply to Re: Invoke object methods with a symbolic reference
by mirod
in thread Invoke object methods with a symbolic reference
by sguazt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |