Rodent Of Unusual Size wrote in perl.module-authors : > > i want to be able to define 'constants' in a module at run time, > rather than at compile time. 'use constant' does it too early.
This is an oxymoron. If your constants change at run time, they're not constant anymore, are they ? But I'm being picky. What you want is probably to define "constant subroutines", i.e. subroutines with an empty prototype, so they can be written FOO without parens or without any & sign, and still not being confused by the perl parser with a bareword or a filehandle. The only solution involves some amount of compile time fudging. You'll have at least to declare the prototype of you constant sub at compile time, for example with sub FOO ();