vladb has asked for the wisdom of the Perl Monks concerning the following question:
-----------------------
Name "CONFIG::foo" used only once: possible typo at
foo_script.pl line 181 (#1)
(W) Typographical errors often show up as unique variable names.
If you had a good reason for having a unique name, then just mention
it again somehow to suppress the message. The use vars pragma is
provided for just this purpose.
-----------------------
The question I have though is that it doesn't look at all normal to do it this way. I also tried playing with this:my $temp = $CONFIG::foo;
However, to no surprise, it wouldn't let me 'redeclare' variables belonging to an 'alien' package (and therefore already 'defined'). Finally, could such a warning really attribute to poor code/logic design? Is it really so wrong and sinful to have a variable (mainly in a configuration package) to be used only once in the main code?use vars qw($CONFIG::foo);
| "There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unique variable names & 'strict vars'
by maverick (Curate) on Dec 20, 2001 at 05:10 UTC | |
|
Re: Unique variable names & 'strict vars'
by VSarkiss (Monsignor) on Dec 20, 2001 at 05:13 UTC | |
by vladb (Vicar) on Dec 20, 2001 at 06:33 UTC | |
|
(shockme) Re: Unique variable names & 'strict vars'
by shockme (Chaplain) on Dec 20, 2001 at 05:35 UTC |