Pollute::Persistent - Perl extension to re-export imported symbols
use Pollute::Persistent; use This; use That; use TheOther; # exports anything imported from This, That or TheOther
Pollute::Persistent's C<import> function creates a lexical varible C<my %before> and puts in it one entry for every entry in the calling package's symbol table. Then it (over)writes the calling package's C<import> function to compare the symbol table as it is now to what it was when Pollute::Persistent was initially used and makes a list of new items. Then it rewrites the C<import> function again to export the new items, and calls the new, concise import function which exports all new items. Subsequent uses of the Persistently Polluting module will get the short import funtion. Pollute::Persistent rewrites its caller's import routine. for later use. Example: In one file, called MyFavoriteModules.pm: package MyFavoriteModules; use Pollute::Persistent; use fred; use jim; use shiela; In another file: use MyFavoriteModules; # imports all symbols exported by fred, jim and shiela In yet another file: use MyFavoriteModules; # uses newly-defined import function.
Pollute::Persistent clobbers its caller's import routine.
David Nicol, <lt>pollute_author@davidnicol.com<gt>
GPL/Artistic. Enjoy.
perl.
To install Pollute, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pollute
CPAN shell
perl -MCPAN -e shell install Pollute
For more information on module installation, please visit the detailed CPAN module installation guide.