I like to enable all strictness, warning verboseness, etc., from tools
to catch mistakes that will otherwise slip by. I was just wondering if
these mechanisms could be enabled from the command line instead of the
source code (i.e., or from a Makefile, etc.). In simple one-liner
tests directly on the command line, it seems to work to pass -Mstrict
and -Mwarnings, but I'm curious if that will affect only the script(s)
directly invoked or if it will affect the entire run-time (including
modules that are imported), regardless of whether modules have said
pragmas or not. Anybody know?

bamcc...@castopulence:~$ perl --version | grep '^This is perl'
This is perl, v5.10.0 built for i486-linux-gnu-thread-multi
bamcc...@castopulence:~$ perl -TW -e '$x = 5;
> print $x, "\n";'
5
bamcc...@castopulence:~$ perl -TW -Mstrict -Mwarnings -e '$x = 5;
> print $x, "\n";'
Global symbol "$x" requires explicit package name at -e line 1.
Global symbol "$x" requires explicit package name at -e line 2.
Execution of -e aborted due to compilation errors.
bamcc...@castopulence:~$

I'm guessing the pragmas would be considered best practice regardless?

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to