Tom Gazzini said:
> I can call a method on an object using the following:
>
> $objref->func()
>
> However, if I try to call this using a symbolic reference:
>
> my $func_name = "$objref->func";
> &{$func_name)();
>
> then I get the following error:
>
> "Undefined subroutine &main::$objref->func called.."
There is a fundamental problem here in that func is a method, and so it
needs an object to call it, but you just want a single reference to a
function. Fortunately, this problem can be solved using a closure to keep
the object details available:
my $func_ref = sub { $objref->func };
$func_ref->();
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]