Just a minor note on the difference in our solutions with respect to Exporter: Perl 5.6 and earlier require Exporter to be subclassed, not just imported.
use Exporter qw(import); # Perl >= 5.8 use base 'Exporter'; # Perl <= 5.6
Even my solution isn't backwards-compatible prior to Perl 5.6 because I included our and warnings. For personal use, this may not matter, but module authors who plan to publish should keep it in mind.
Update: For Perl >=5.8 I changed the example to note that you need to specify import.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In reply to Re^2: "use Foo.pm" twice from inside different packages...
by xdg
in thread "use Foo.pm" twice from inside different packages...
by wazoox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |