Exporting functions by attributes

Yuval Kogman nothingmuch at woobling.org
Tue Oct 9 06:27:55 BST 2007


It breaks with require, since INIT/CHECK only fire at real startup.

Also, it pollutes UNIVERSAL.

On Tue, Oct 09, 2007 at 14:59:07 +1000, Toby Corkindale wrote:
> 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.
> 
> -Toby

-- 
  Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org  0xEBD27418



More information about the london.pm mailing list