On May 10, 5:29 am, t.baetz...@bringe.com (Thomas Bätzler) wrote:
> Hi Shlomi,
>
> > use warnings is preferable to the -w flag.
>
> Not in my book. The command line switch turns on warnings globally, whereas 
> the "use warnings;" pragma only enables them in the current lexical scope. So 
> by using the command line switch, I get warnings about crappy third-party 
> code, too.
>
> The only case where "use warnings;" might be better is if you're using a 
> braindead shell/OS that doesn't look at the shebang line.
>

Actually,  perl helps the braindead too. At least,
as far as I can see from a quick read of perlrun:

    The #! line is always examined for switches
    as the line is being parsed. Thus, if you're on
    a machine that allows only one argument with
    the #line, or worse, doesn't even recognize the
    #! line, you still can get consistent switch behavior
    regardless of how Perl was invoked, even if -x
    was used to find the beginning of the program.

There are a couple of gotcha's mentioned in perlrun's
subsequent paragraphs:  'perl' needs to be seen on the
shebang line; more than 32 char's historically could be
problematic; redundant switch traps, etc.

--
Charles DeRykus


--
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