Global Variables Question
Hello All, I apologize if this is in a FAQ somewhere. I have a script, lets call it test.pl. Test.pl requires in config.pl. Test.pl uses variables (via use vars) from config.pl. These variables are defined and given values in config.pl. AFter the first usage of test.pl, the variables we are pulling in from config.pl no longer have values. So it's something like this: config.pl use vars ($G_ROOTPATH); $G_ROOTPATH = /home/warren; config.pl test.pl require config.pl; use vars ($G_ROOTPATH); # at this point, G_ROOTPATH is inherited from config.pl and has the value of /home/warren test.pl On the first run of the script G_ROOTPATH in test.pl has the value of home/warren... subsequent runs, it does not. I'm a little confused as to exact ways modperl handles global variables. Anyone have a simple tweak for this? Or do I have to make a config package? Thanks in advance!
Re: Global Variables Question
http://perl.apache.org/guide/porting.html#Configuration_Files_Writing_Dy Guide Good! Warren D. Johnson wrote: Hello All, I apologize if this is in a FAQ somewhere. I have a script, lets call it test.pl. Test.pl requires in config.pl. Test.pl uses variables (via use vars) from config.pl. These variables are defined and given values in config.pl. AFter the first usage of test.pl, the variables we are pulling in from config.pl no longer have values. So it's something like this: config.pl use vars ($G_ROOTPATH); $G_ROOTPATH = /home/warren; config.pl test.pl require config.pl; use vars ($G_ROOTPATH); # at this point, G_ROOTPATH is inherited from config.pl and has the value of /home/warren test.pl On the first run of the script G_ROOTPATH in test.pl has the value of home/warren... subsequent runs, it does not. I'm a little confused as to exact ways modperl handles global variables. Anyone have a simple tweak for this? Or do I have to make a config package? Thanks in advance!