On 24 Jun 2005 17:44:47 GMT,
(Anno
Siegel) wrote:
>Henry Law <> wrote in comp.lang.perl.misc:
>> I have a main program and two packages. The first package loads up a
>> number of system-wide variables and exposes them to the program that
>> uses them. The second package has utility subroutines, some of which
>> need access to variables exposed by the first package.
>If it must stay global, Utilities should import it from ClientGlobal
>on its own instead of relying on main:: to do it and making a cross-
>package access. main:: can import it as well, if it needs to know.
>That's the purpose of a configuration module like ClientGlobal that
>whichever part of the program can consistently import what it needs
>from it.
Thanks, Paul and Anno. There is a reason why I'm trying to do what
I'm doing but the faint whiff of not-right-ness has now become a foul
reek so I fear I can't avoid some re-structuring.
But before I crawl back to my editor, advise me once more: the
routines I'm writing make quite intensive use of a small set of
system-wide variables - the host name of the server, for example, the
name of the database to connect to, the name of the log file, etc etc.
I'm as against global variables as the next guy (learnt that in APL
programming way back last century) but what is the most convenient way
of making them accessible when they're needed?
--
Henry Law <>< Manchester, England