vancetech has asked for the wisdom of the Perl Monks concerning the following question:
Whats the correct way of using constants in a large multi-script and package environment? I have a large list of constants in a seperate file like this:
use constant VERSION => "1.5.7"; ....
To use them in my web scripts (webscript.cgi) so I would do this:
#!/usr/bin/perl use strict; BEGIN { require "../constants.pl"; }; print VERSION;
Now I am writing a package to use within the website and would like it to have access to the constants as well. When I require them in this package I get errors saying:
Bareword "VERSION" not allowed while strict subs in use at ./webscript +.cgi
Does anyone have a better suggestion to approaching using constants in this way?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using constants in multiple scripts
by ELISHEVA (Prior) on Mar 05, 2009 at 10:07 UTC | |
|
Re: Using constants in multiple scripts
by rovf (Priest) on Mar 05, 2009 at 11:51 UTC |