Do not execute this in a BEGIN block, or it'll be too early. You want to let the compiler first read the whole file first, then execute this code on the run pass.
Consider also using @EXPORT_OK instead of @EXPORT, so that your list of exported functions doesn't accidentally change.
Also, you can add more restrictions to the grep to exclude functions that begin with an underscore, for example.
our @EXPORT = do { no strict 'refs'; grep exists &$_, keys %{ __PACKAGE__ . '::'}; };
In reply to Automatically add all defined functions to your @EXPORT by merlyn
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |