in reply to Re: Referencing methods
in thread Referencing methods
Unfortunately you can't create a reference an object methodLuckily this turns out not to be the case. can returns a reference to the method you're looking for, and undef if that method doesn't exist, so you can write code like:
if that floats your boat. Just remember that what's returned is a regular sub ref, so you need to pass in the object or class name as the first parameter.my $ref = $obj->can($meth_name); $ref->($obj, @params);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Referencing methods
by broquaint (Abbot) on May 08, 2003 at 16:05 UTC | |
by Elian (Parson) on May 08, 2003 at 17:15 UTC |