in reply to How to make Common Variables defined in Module available to Scripts
Should I declare them as "our" variables, or should I just create a subroutine in the module and pass copies of the variables to the scripts by way of the subroutine, or would something else be better?
Either is ok, but which is best depends solely on the purpose of the modules and the data encapsulation that is required. Are the variables read-only? would setting the variables to some value have nefarious consequences? are they subject to security concerns?
There are many ways to do what you are after, e.g. have a look at the Config.pm code for an implementation of a read-only hash.
Rules of thumb:
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to make Common Variables defined in Module available to Scripts
by memnoch (Scribe) on Dec 06, 2007 at 16:27 UTC | |
by CountZero (Bishop) on Dec 07, 2007 at 06:45 UTC | |
by FunkyMonk (Bishop) on Dec 06, 2007 at 17:44 UTC |