in reply to our scope and packages
There seems to be very little on the function "our" in manuals and tutorials.
This observation is correct, and that's because there are few if any projects that are not improved by a global s/our/my/.
Of course that will break your existing system of letting everybody share the same global variable. This is generally considered a good thing.
In the file where you declare and populate my %prod, follow it up with an offer to share:
sub get_prod_ref { return \%prod; }
and now let client files say
use My::Configuration; my $prod_ref = My::Configuration::get_prod_ref(); # or if you prefer my %prod = %{ My::Configuration::get_prod_ref() };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Abandon "our" declarations (was: Re: our scope and packages) (export)
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 |