Exporter-Extensible
view release on metacpan or search on metacpan
lib/Exporter/Extensible.pm view on Meta::CPAN
}
$class->exporter_register_tag_members($_, @export_names) for keys %tags;
return 1;
}
return;
}
sub exporter_setup {
my ($self, $version)= @_;
push @{$self->{into}.'::ISA'}, ref($self);
strict->import;
warnings->import;
if ($version == 1) {
# Declare 'our %EXPORT'
*{$self->{into}.'::EXPORT'}= \%{$self->{into}.'::EXPORT'};
# Make @EXPORT and $EXPORT_TAGS{default} be the same arrayref.
# Allow either one to have been declared already.
my $tags= \%{$self->{into}.'::EXPORT_TAGS'};
*{$self->{into}.'::EXPORT'}= $tags->{default}
if ref $tags->{default} eq 'ARRAY';
$tags->{default} ||= \@{$self->{into}.'::EXPORT'};
lib/Exporter/Extensible.pm view on Meta::CPAN
Define a module with exports
package My::Utils;
use Exporter::Extensible -exporter_setup => 1;
export(qw( foo $x @STUFF -strict_and_warnings ), ':baz' => ['foo'] );
sub foo { ... }
sub strict_and_warnings {
strict->import;
warnings->import;
}
Create a new module which exports all that, and more
package My::MoreUtils;
use My::Utils -exporter_setup => 1;
sub util_fn3 : Export(:baz) { ... }
Use the module
( run in 0.413 second using v1.01-cache-2.11-cpan-299005ec8e3 )