my $package = 'main'; my $function = 'foo'; { no strict 'refs'; if (defined &{$package.'::'$function}) { print "$function is defined in $package\n"; } }
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
In reply to Re: checking from a module if a sub exists in main::
by dragonchild
in thread checking from a module if a sub exists in main::
by tune
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |