I prefer to not do the method-lookup twice and use the code reference returned by can:
$self->$code(...) where $code is a subroutine reference is equivalent to $code->($self, ...); you can even do []->$code or undef()->$code if you want.if (my $code = $self->can($method)) { $self->$code(...); }
ihb
See perltoc if you don't know which perldoc to read!
In reply to Re^4: Am I evil for doing this?
by ihb
in thread Am I evil for doing this?
by Whitehawke
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |