Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: package splitting and 'our' use

by thcsoft (Monk)
on May 10, 2005 at 03:31 UTC ( #455420=note: print w/replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://455420]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2023-06-10 00:41 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (36 votes). Check out past polls.