in reply to Re: code that runs at module loading
in thread code that runs at module loading

Having the script that uses the constant generate the code at compile time (in a BEGIN block) is one of the wonderful features of Perl that distinguishes it from other languages. Why not make use of it?

Replies are listed 'Best First'.
Re^3: code that runs at module loading
by sgifford (Prior) on Dec 07, 2004 at 21:06 UTC
    I was just throwing out a technique I use sometimes to see if the OP might find it useful; it's not necessarily the best strategy here. It's useful if the constants take a long time to generate, or if they're actual use constant declarations, which Perl can optimize away at compile-time if it knows them beforehand.