I don't like it either ;)
I'm really wanting to understand why my $one isn't working, I think it's in scope!
As I explained above, I'll also be wanting to access variables from my config file - something like below, expect this doesn't work.
test.pl
#!/usr/bin/perl -wT
use strict;
use lib '/home/4220/straitwa/www.straitway.net/shop_34/lib';
use Shop;
my ($conf);
#open the config file and parse it
unless ($conf = do ('/home/4220/straitwa/www.straitway.net/shop_34/con
+f.pl')) {
die ("Could not open config file");
}
Shop::db_connect;
Shop.pmpackage Shop;
use strict;
use Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = ();
@EXPORT_OK = qw(db_connect);
sub db_connect {
print $conf->{'db_database'};
}
1;
conf.pl{
db_database => 'straitway_1',
}
What I'm wanting is the module Shop.pm to use the data in conf.pl, but I'm getting the error messageGlobal symbol "$conf" requires explicit package name at /home/4220/str
+aitwa/www.straitway.net/shop_34/lib/Shop.pm line 13.
Compilation failed in require at ./test.pl line 4.
BEGIN failed--compilation aborted at ./test.pl line 4.
|