in reply to Sharing Namespaces
I'd say explicitly pass the data back with a subroutine call.
In the modules that use Config:package Config; require Exporter; our @ISA=qw(Exporter); our @EXPORT_OK=qw(read_config); sub read_config { my %data; # read configuration file in and # put values into a hash return \%data; }
package One; use Config qw(read_config); my $conf = read_config();
Granted, you then have your configuration data in a hash and need to call it with e.g. $conf->{logfile} instead of $logfile but IMO that's cleaner anyway.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sharing Namespaces
by skazat (Chaplain) on Jan 27, 2006 at 09:25 UTC | |
by tirwhan (Abbot) on Jan 27, 2006 at 09:58 UTC |