in reply to Global variables
package Foo; use base 'Exporter; our @EXPORT_OK = qw(foo_this foo_that); sub foo_this { ... }
Having to specify the exporting package is a good thing IMO, since it clarifies where the functions/vars are defined and it makes it possible to re-use "global" names in/from different packages. Both can be useful if your program is growing.use Foo qw(foo_this foo_that);
The only downside to Exporter is that it can get a bit verbose. I kind of like the syntax in Perl6::Export::Attrs.
update: s/Perl6::Export/Perl6::Export::Attrs/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Global variables
by polettix (Vicar) on Oct 02, 2006 at 22:02 UTC | |
by Joost (Canon) on Oct 02, 2006 at 22:21 UTC |