Exports
Export routines from a package with names specified by caller of the package.
Synopsis
use Math::Zap::Vector vector=>'v', units=>'u';
my $x = v(1,0,0);
my $y = u();
Rather than:
my $x = Math::Zap::Vector::vector(1,0,0);
my $y = Math::Zap::Vector::units();
Description
Export routines from a package with names specified by caller of the package. The routines to be exported are defined in the exporting package Math::Zap::As: $VERSION=1.07;
use Math::Zap::Exports qw(
vector ($$$)
units ()
);
A suitable sub import() is created, allowing the caller to specify:
use Math::Zap::Vector vector=>'v', units=>'u';
The caller may then refer to Math::Zap::Vector::vector() as v() and Math::Zap::Vector::units() as u().
The first routine exported is always imported by its export name unless a new name is supplied. Thus:
use Math::Zap::Vector;
and
use Math::Zap::Vector vector=>'vector';
have identical effects.
The advantage of this is approach is that it allows the importing package Math::Zap::To control the names of the exported routines in its name space $VERSION=1.07; rather than the developer of the exporting package, a facility I have not been able to discover in the standard Perl Exporter.pm.
PhilipRBrenan@yahoo.com, 2004, Perl licence
Method: Exports
Construct import routine.
Credits
Author
philiprbrenan@yahoo.com
Copyright
philiprbrenan@yahoo.com, 2004
License
Perl License.