CGI::FormMagick::Sub - Call subs by name.
use CGI::FormMagick::Sub; my %sub = ( package => $some_package_name, sub => $some_sub_name, args => \@array_of_args, comma_delimited_args => $string_of_comma_delimited_args, ); CGI::FormMagick::Sub::exists(%sub) or return undef; return CGI::FormMagick::Sub::call(%sub);
(Intended for internal use only.)
Used for calling subs whose names are dynamically generated.
exists() takes a hash with keys "package" and "sub". Returns true if the sub exists, false otherwise.
call() takes a hash with keys "package" and "sub", and optional "args" and "comma_delimited_args". The "comma_delimited_args" are split up and pushed into the array of args to be sent to the sub when called. Returns the return of the called sub itself.
If the sub doesn't exist, it will return undef. If $^W is true, it will also complain.