in reply to Re^2: code that runs at module loading
in thread code that runs at module loading
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.