in reply to exporting vars
export_to_level is a special routine provided by Exporter that allows you to control where the symbols will be exported to. The 1 here means export 1 level up. So it's saying "Hey A, don't export your symbols into my package (A1) export them into the package I was called from (B in your example)".package A1; sub import { A->export_to_level(1, @_); }
A quick plug for one of my modules. Exporter::Easy lets you write
asBEGIN { use Exporter(); use vars qw(@EXPORT @ISA); @EXPORT = qw($var1); @ISA = qw(Exporter); } use vars @EXPORT; $var1 = "1";
it handles setting up all the other Exporter arrays too if you want it.use Exporter::Easiest q( EXPORT => $var1 ); $var1 = "1";
|
|---|