To make myself a better programmer, I am using "use strict."
Everything was fine until I split the code from the config. I want to use several configs, but 1 piece of code.
So I put the config in a file called submit6.pl which contains several variables:
my $apachelog = "/path/to/apachelog.log";
my $testing = 1;
Then there is a line like this:
use lib "/path/to/lib";
use referer_mailer;
In referer_mailer.pm, I'm trying to access the variables set in submit6.pl. If I use "our" instead of "my" I get the famed Global symbol "$apachelog" requires explicit package name at ./submit6test.cgi line 9.
How do I have to declare the variables in the program that is run (submit6.pl) so that I can access them in the code in referer_mailer.pm?
OR
How do I get/call the variables from submit6.pl from within referer_mailer.pm?
I've tried $main::apachelog, tried giving submit6.pl a package name then calling the vars as $conf::apachelog, to no avail. I used to be good with perl, but then went to PHP, and now my perl is weak.
I could fix all of this by not "use strict"ing, but I feel it is best to do it right.
Thanks
Everything was fine until I split the code from the config. I want to use several configs, but 1 piece of code.
So I put the config in a file called submit6.pl which contains several variables:
my $apachelog = "/path/to/apachelog.log";
my $testing = 1;
Then there is a line like this:
use lib "/path/to/lib";
use referer_mailer;
In referer_mailer.pm, I'm trying to access the variables set in submit6.pl. If I use "our" instead of "my" I get the famed Global symbol "$apachelog" requires explicit package name at ./submit6test.cgi line 9.
How do I have to declare the variables in the program that is run (submit6.pl) so that I can access them in the code in referer_mailer.pm?
OR
How do I get/call the variables from submit6.pl from within referer_mailer.pm?
I've tried $main::apachelog, tried giving submit6.pl a package name then calling the vars as $conf::apachelog, to no avail. I used to be good with perl, but then went to PHP, and now my perl is weak.
I could fix all of this by not "use strict"ing, but I feel it is best to do it right.
Thanks