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()
Package Foo; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw($foo foobar); $foo = "bar"; sub foobar { $blah = "hi"; print "$foo $blah\n"; } 1;
I wrote a perl script (foo.pl) that imports Foo.pm:
#!/usr/bin/perl use Foo qw(foobar); $bar = "hi"; foobar();
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:
perl -w foo.pl
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.
In reply to Re^3: scope of "use strict"? (needed: "superstrict")
by argv
in thread scope of "use strict"? (needed: "superstrict")
by argv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |