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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: our scope and packages
by tilly (Archbishop) on Aug 28, 2008 at 23:01 UTC | |
by jfrm (Monk) on Aug 28, 2008 at 23:12 UTC | |
by tilly (Archbishop) on Aug 28, 2008 at 23:23 UTC | |
by jfrm (Monk) on Aug 28, 2008 at 23:36 UTC | |
by tilly (Archbishop) on Aug 29, 2008 at 11:33 UTC | |
| |
Re: our scope and packages
by ikegami (Patriarch) on Aug 28, 2008 at 23:09 UTC | |
Re: our scope and packages
by betterworld (Curate) on Aug 28, 2008 at 23:09 UTC | |
Abandon "our" declarations (was: Re: our scope and packages)
by Narveson (Chaplain) on Aug 29, 2008 at 05:00 UTC | |
by tye (Sage) on Aug 29, 2008 at 06:45 UTC | |
by rir (Vicar) on Aug 29, 2008 at 18:14 UTC | |
by tye (Sage) on Aug 30, 2008 at 06:21 UTC | |
Re: our scope and packages
by cbrandtbuffalo (Deacon) on Aug 29, 2008 at 12:04 UTC |