in reply to Advice on Global Constants

To relieve the immediate pain, first thing I would do is identifiying the use of various hash keys among the file set of the application in question and move the shared keys into *.pm files which export those constants, to be used by those files using the constants - "divide et impera" - much like C header files. That would help with the 'single file issue', but it might introduce more complexity at another level.

Next you could consider restricting the key set of a hash via Hash::Util, or using accessors, probably as lvalue subs, e.g.

sub this_id :lvalue { $_[0]->{this_id} = $_[1] if @_ > 1; $_[0]->{this_id}; }

Then you can say

$r->thisid = 10;

but for this notation, $r has to be blessed into the package this constant lvalue sub is defined in.

update: corrected sub

--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}