also - pragma to export a module into your caller's namespace
My/Mod.pm:
package My::Mod; use also 'My::OtherMod' => [ qw/foo bar/ ];
program:
use My::Mod;
this is now effectively:
use My::Mod; use My::OtherMod qw/foo bar/;
also will export a module into your caller's namespace as well as yours. It does this by replacing your import method with one which does the imports and then calls the original: this means that you must define your import method before you use all. If you don't and you have warnings turned on you will get a "Subroutine import redefined" warning.
also
import
use all
The arguments to use also are modules to import. If a module name is followed by an arrayref, its contents are passed as the arguments to that module's import function; if the arrayref is empty (i.e. if you write
use also
use also 'My::Mod' => [];
) then the module's import function will not be called at all. (This will have the same effect as
use My::Mod ();
, and thus is perhaps rather pointless :).
Ben Morrow <also-pm@morrow.me.uk>
Copyright 2004 Ben Morrow.
This program is released under the same terms as Perl.
To install also, copy and paste the appropriate command in to your terminal.
cpanm
cpanm also
CPAN shell
perl -MCPAN -e shell install also
For more information on module installation, please visit the detailed CPAN module installation guide.