in reply to use Strict: a rigorous way to break my command line variables?
Short explanation: The name of the module is strict, all lower case. Because Windows is case insensitive, use Strict; will load the module even though it is already loaded. It won't do anything useful with it, but it will load it. Since it was already loaded by something else (or else something else loads it after you did), you get redefinition warnings and no useful effect. Change it to the proper case and you'll have no redefinition warnings, and the module will do something for you.
Long explanation. When you type use Strict; Perl proceeds to do the following:
require checks %INC to see whether "Strict.pm" is loaded, and then tries to load it if not. However %INC is case sensitive, so it won't notice that Strict.pm is there if it is looking for strict.pm, and vice versa. Since Windows is case insensitive, if you look for Strict.pm you'll find strict.pm. So Perl decides it doesn't have the module, and tries to load it. Since you're loading the same code twice, you get redefinition errors.BEGIN { require Strict; Strict->import(); }
Your bigger problem, though, is that the line Strict->import(); won't do anything useful. You see strict.pm only implements strict::import. So there is no Strict::import to find, and nothing happens.
So make it use strict; and Perl will not try to reload the same module, and (more importantly) Perl will make the method call that turns strict on in your code.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: use Strict: a rigorous way to break my command line variables?
by NamfFohyr (Scribe) on Aug 09, 2006 at 02:31 UTC | |
by tilly (Archbishop) on Aug 09, 2006 at 02:33 UTC | |
by sgt (Deacon) on Aug 10, 2006 at 20:42 UTC | |
Re^2: use Strict: a rigorous way to break my command line variables?
by rodion (Chaplain) on Aug 09, 2006 at 02:36 UTC | |
by tilly (Archbishop) on Aug 09, 2006 at 02:47 UTC | |
by rodion (Chaplain) on Aug 09, 2006 at 03:13 UTC | |
by bart (Canon) on Aug 09, 2006 at 21:59 UTC |