![]() |
|
laziness, impatience, and hubris | |
PerlMonks |
our scope and packagesby jfrm (Monk) |
on Aug 28, 2008 at 22:50 UTC ( #707620=perlquestion: print w/replies, xml ) | Need Help?? |
jfrm has asked for the wisdom of the Perl Monks concerning the following question: I am deeply frustrated and it's not just because I'm stuck in this monastery with a bunch of bald blokes. I'm never too good with scoping and I'm sure this is a dumb question but here goes. I've been using a hash for a long time within perl files in my webroot/cgi-bin directory that I initialise in the opening file with our %prod; Then in other files that are "use"d, I declare our %prod; and happily use it. Now I've been gradually turning object oriented in my old age and for the first time, I want to use %prod in a package file called webroot/MG/Product.pm Now when I do our %prod; and try to use it, I can't - it isn't populated. Presumably %prod is no longer in scope - perhaps due to the location of the file not being in the same directory? Anyway, please please can someone tell me how I can access %prod from my package. There seems to be very little on the function "our" in manuals and tutorials. thanks.
Back to
Seekers of Perl Wisdom
|
|