in reply to Re: Calling a class method name in a scalar using :: syntax
in thread Calling a class method name in a scalar using :: syntax
This works because can is returning a reference to the subroutine in MODULES::$submodule and then that it is being called with $data being passed in.my $result = "MODULES::$submodule"->can($method)->($data);
Or, simpler still, if it's a class method then you don't need any trickery
That just uses the string "MODULES::$submodule" as the class and then calls the method as designated by $method.my $result = "MODULES::$submodule"->$method($data);
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Calling a class method name in a scalar using :: syntax
by rufus (Initiate) on Sep 04, 2003 at 15:54 UTC |