in reply to Exporting all variables and subroutines using Exporter
For variables you would want to use Exporter for the subroutines you would want to use AutoLoader
You may or may not need to use "BEGIN". What I do is drop AutoLoader and just use Exporter. Because an object/OO can have all its methods in the object variable and you can pass that around with exporter instead of autoloader.BEGIN { use strict; use warnings; use vars qw ( @ISA @EXPORT $var1 %var2 @var3 ); require Exporter; require AutoLoader; @ISA = qw(Exporter AutoLoader); @EXPORT = qw(sub1 sub2 $var1 %var2 @var3); } # ...
|
|---|