The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

also - pragma to export a module into your caller's namespace

SYNOPSIS

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/;

DESCRIPTION

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.

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 '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 :).

AUTHOR

Ben Morrow <also-pm@morrow.me.uk>

COPYRIGHT

Copyright 2004 Ben Morrow.

This program is released under the same terms as Perl.