hartzell has asked for the wisdom of the Perl Monks concerning the following question:
But that ExtUtils-ModuleMaker-0.32 (which I found via a module best-practices thread) does this:BEGIN { use Exporter (); our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); # set the version for version checking $VERSION = 1.00; # if using RCS/CVS, this may be preferred $VERSION = sprintf "%d.%03d", q$Revision: 1.1 $ =~ /(\d+)/g; @ISA = qw(Exporter); @EXPORT = qw(&func1 &func2 &func4); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], # your exported package globals go here, # as well as any optionally exported functions @EXPORT_OK = qw($Var1 %Hashit &func3); }
and other examples (that I can't find at the moment) do without the BEGIN block. I'd like to be able to explain the differences to other folks, but don't know all of the history, so I have a few questions:BEGIN { use Exporter (); use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 0.01; @ISA = qw (Exporter); #Give a hoot don't pollute, do not export more than needed by +default @EXPORT = qw (); @EXPORT_OK = qw (); %EXPORT_TAGS = (); }
Edit by tye, replace PRE with CODE
|
|---|