in reply to package splitting and 'our' use

i think, what you like to achieve could be easier realized this way:
package MyConfig; use strict; use vars qw/@settings/; # now fill in values in the setings list. ...
and then:
package MyModule; use strict; our @settings; *settings = \@MyConfig::settings; ...
that's at least the way i'm doing it, but it works perfectly well. btw: wouldn't a hashtable be a better approach?

language is a virus from outer space.

Replies are listed 'Best First'.
Re^2: package splitting and 'our' use
by steves (Curate) on May 10, 2005 at 04:31 UTC

    I considered this approach. What I don't like about it is that it forces every package the set-up affects to know about the set-up. I'd rather keep the set-up hidden, writing the packages to use things without worrying about where they come from.

    The use of an array for settings was only for illustration purposes. The real implementation of this would be using different data structures; primarily hashes.