Exporter::Easy 0.16 review

Download
by rbytes.net on

Exporter::Easy is a Perl module that takes the drudgery out of Exporting symbols. SYNOPSIS In module YourModule.pm: package

License: Perl Artistic License
File size: 9K
Developer: Fergal Daly
0 stars award from rbytes.net

Exporter::Easy is a Perl module that takes the drudgery out of Exporting symbols.

SYNOPSIS

In module YourModule.pm:
package YourModule;
use Exporter::Easy (
OK => [ '$munge', 'frobnicate' ] # symbols to export on request
);
In other files which wish to use YourModule:
use ModuleName qw(frobnicate); # import listed symbols
frobnicate ($left, $right) # calls YourModule::frobnicate

Exporter::Easy makes using Exporter easy. In it's simplest case it allows you to drop the boilerplate code that comes with using Exporter, so

require Exporter;
use base qw( Exporter );
use vars qw( @EXPORT );
@EXPORT = ( 'init' );
becomes
use Exporter::Easy ( EXPORT => [ 'init' ] );
and more complicated situations where you use tags to build lists and more tags become easy, like this
use Exporter::Easy (
EXPORT => [qw( init :base )],
TAGS => [
base => [qw( open close )],
read => [qw( read sysread readline )],
write => [qw( print write writeline )],
misc => [qw( select flush )],
all => [qw( :base :read :write :misc)],
no_misc => [qw( :all !:misc )],
],
OK => [qw( some other stuff )],
);

This will set @EXPORT, @EXPORT_OK, @EXPORT_FAIL and %EXPORT_TAGS in the current package, add Exporter to that package's @ISA and do a use vars on all the variables mentioned. The rest is handled as normal by Exporter.

Requirements:
Perl

Exporter::Easy 0.16 keywords