in reply to External script to hold common procedure calls
package main; # mixin use IO::File qw(whatever); use Net::..... use SomethingElse; use EtCetera; 1;
This will put everything in the main namespace, which may be good enough for you. If, however, you want to call this from a different namespace and want everything imported there, you need some more magic than a (naive) mixin:
package Everything; sub import { my $pkg = caller; eval qq{ package $pkg; use This; use That; use And::So::On; 1; } or die $@; } 1;
That said, this is probably a bad idea if taken to the extreme. You'll have "namespace pollution", that is, the modules you use will fight for each other's subroutine names.
(Anyone know how to do this without the eval?)
|
|---|