NAME
Sub::Spec::Exporter - Flexible and painless exporting for your subs
VERSION
version 0.05
DESCRIPTION
If your module does not have an "import" subroutine, Sub::Spec will install one for you. This exporter is pretty flexible. You can import individual subroutines:
use MyModule qw(foo bar);
All subroutines which has a spec will be exportable (unless they are set with private=>1).
You can also import Import sets of subroutines via tags. These tags are gathered from the spec's export_tags.
use MyModule qw(:sometag);
You can import into another name:
use MyModule foo => { as => newfoo }, bar => { as => foo };
You can add extra clauses into a sub:
use MyModule foo => { -as => newfoo, add => {timeout => 5} };
You can also add extra clauses to all imported subs:
use MyModule 'foo', 'bar', ':sometag', -add => {timeout => 5};
SYNTAX
use MyModule 'SUBNAME', 'SUBNAME', ...;
use MyModule ':TAGNAME', ...;
use MyModule -EXPORT_CLAUSE => ARG, ...;
use MyModule SUBNAME => { -EXPORT_CLAUSE => ARG, ...}, ':TAGNAME'=>{...}, ...;
Inside { ... }, you can leave out the dash (-
) prefix, but it's okay if you still use it.
EXPORT CLAUSES
-as
Export to another name.
-add
Add sub spec clauses.
-remove
Remove sub spec clauses.
-set
Replace sub spec clauses.
AUTHOR
Steven Haryanto <stevenharyanto@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.