|Keep It Simple, Stupid|
How to include a large number of constants?by noslenj123 (Scribe)
|on Apr 27, 2005 at 17:39 UTC||Need Help??|
noslenj123 has asked for the wisdom of the Perl Monks concerning the following question:
I am working on a program that has several hundred constants and I'm trying to figure out a good way to include those via a required file or a used module. I've run into problems and looking for advice.
If I require a file full of constants in g1.inc like
And use it like
I receive: 'Bareword "OPEN_REQ" not allowed while "strict subs"'. I had thought for some reason requiring a file is like inserting that code at that spot in the script. Is it a compiletime vs runtime issue?
If I use a module, what is the briefest way to pass my large number of declared constants into the main namespace without retyping everyone of them into @EXPORT?
I await your witty wisdom. :-)