in reply to (Ovid) Re: calling methods using a variable
in thread calling methods using a variable
It would also prudent to throw a next unless $g->can($command); or something in there so that things don't go bewm if $command doesn't exist (ie, someone made a tipo [sic.]).
You might even want to throw in some security checks for good measure...
foreach (@commands) { my ( $command, @args ) = @$_; warn("Naughty, $command not allowed..."), next unless $permitted{$command}; warn("Ooops, I can't find $command..."), next unless $g->can($command); $g->$command( @args ); }
--k.
|
|---|