Exporting functions by attributes
tjc at wintrmute.net
Tue Oct 9 05:59:07 BST 2007
It occurred to me earlier that exporting functions from modules in the
traditional way, ie. as given in `perldoc Exporter`, seems poor,
especially with the availability of function attributes in recent
versions of Perl.
I had a search around on CPAN, and found that there are already at least
seven different Exporter variants - Classic, Easy, Easiest, Lite,
NoWork, Simple and Tidy. (There are probably more, but I stopped looking
at this point).
For the record, Exporter::Simple does what I had in mind - you can tag
functions with attributes Exported or Exportable (exported by default or
optionally). More info in their docs.
I thought I'd pass this along as I found it interesting.
It won't work on older pre-attribute versions of Perl of course.
More information about the london.pm