Just an RFC for the module. Mostly on its name rather than abilities. Current POD:
NAME
Attribute::Export - set exportability at the subroutine definition.
SYNOPSIS
package Fred;
use base qw( Attribute::Export );
sub foo : Exported { print "Hello world!\n" }
sub bar : Exportable { print "Hello bar!\n" }
sub quux : Exportable(:Blah) { print 42 }
1;
Some program:
use Fred;
foo();
use Fred qw( bar );
bar();
use Fred qw( :Blah );
quux();
DESCRIPTION
This description assumes a familiarity with the Exporter module.
Marking a subroutine as "Exported" is like putting it in @EXPORTS.
Marking it "Exportable" is akin to @EXPORT_OK.
No more needing to declare and define @EXPORTS and @EXPORT_OK. No more
needing to modify them when you rename a function.
Just a straight simple:
sub bar : Exportable { ... }
or
sub quux : Exported { ... }
"Attribute::Export" supports export groups. Just list them in the parens
after the attribute. For example:
sub bar : Exportable(:all,:foo)
QUIRKS
You may experience some quirks due to the implementation. Since
attributes aren't verified before "import()" is called we delay the
execution of "import()" until the "INIT" phase. Practical effect? Damned
if I know. Hasn't proved to be a problem.
If you call "import()" directly, then it will import the requested
functions then. Run-time vs compile-time thing.
LIMITATIONS
Only exports, or marks for exportability, subroutines. Not scalars, not
arrays, not hashes. Just subs.
Support for other types is on the todoyama. Probably.
Use of "Exportable(foom)" is reserved for renaming functions on export.
SEE ALSO
Exporter, Attribute::Handlers, attributes.
pgp00000.pgp
Description: PGP signature
