Problems? Is your data what you think it is? | |
PerlMonks |
Re^3: scope of "use strict"? (needed: "superstrict")by argv (Pilgrim) |
on Jul 07, 2005 at 05:14 UTC ( [id://473031]=note: print w/replies, xml ) | Need Help?? |
Using -w on the command line will turn on warning for the script AND for modules (unless they explicitely turn them off). Geez--call me stupid... but this doesn't seem to do it for me. I've got a simple perl module Foo.pm that exports a single function, foobar()
I wrote a perl script (foo.pl) that imports Foo.pm:
I inserted stuff in both the .pl and the .pm files that should generate warnings to test this. (Running foo.pl with no warnings is clean, expectedly.) So, I run:
and sure enough, I get a warning in my foo.pl script, but I do not get a warning for the $blah = "hi"; line in Foo.pm. If I add "use warnings;" to the top of Foo.pm as well, then yes, I do get a warning for Foo.pm. But, this goes against what you said: that "perl -w" should propagate the warnings to all the modules... what am I missing? dan ps. On another note entirely, "use strict;" in the module complains about $bar, which is exported. This is how the doc says to do it, and I see no other resource that says differently.
Dan Heller http://www.danheller.com
In Section
Seekers of Perl Wisdom
|
|