It is an associate array that specifies a way to access a list of symbols with tags.
Syntax:
%EXPORT_TAGS = (tag_name => [anonymous array/Array reference]);
For Example:
%EXPORT_TAGS = (
all => @EXPORT_OK
);
At the time of loading, use simply
use Module qw(:all); # instead of writing all the symbols
MyPerl.pm
---------------------------
package MyPerl;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(&Active);
our @EXPORT_OK = qw(&StrawBerry &IndigoStar);
our %EXPORT_TAGS = (
'Explicit' => \@EXPORT,
'Implicit' => \@EXPORT_OK,
'All' => [@EXPORT, @EXPORT_OK],
);
sub Active {
print "Active Perl\n";
}
sub StrawBerry {
print "StrawBerry Perl\n";
}
sub IndigoStar {
print "IndigoStar Perl\n";
}
1;
test.pl
---------------------
#!/usr/local/bin/perl
use MyPerl qw(:Explicit :Implicit);
#or
#use MyPerl qw(:All);
Active();
IndigoStar();
Syntax:
%EXPORT_TAGS = (tag_name => [anonymous array/Array reference]);
For Example:
%EXPORT_TAGS = (
all => @EXPORT_OK
);
At the time of loading, use simply
use Module qw(:all); # instead of writing all the symbols
MyPerl.pm
---------------------------
package MyPerl;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(&Active);
our @EXPORT_OK = qw(&StrawBerry &IndigoStar);
our %EXPORT_TAGS = (
'Explicit' => \@EXPORT,
'Implicit' => \@EXPORT_OK,
'All' => [@EXPORT, @EXPORT_OK],
);
sub Active {
print "Active Perl\n";
}
sub StrawBerry {
print "StrawBerry Perl\n";
}
sub IndigoStar {
print "IndigoStar Perl\n";
}
1;
test.pl
---------------------
#!/usr/local/bin/perl
use MyPerl qw(:Explicit :Implicit);
#or
#use MyPerl qw(:All);
Active();
IndigoStar();
No comments :
Post a Comment