in reply to use warnings vs. perl -w

Under Windows you should start all of your scripts with

#!/usr/bin/perl -w
Surprised? Note that this won't tell the operating system to look for perl.exe in the /usr/bin directory. It will tell perl to turn on warnings, even on Windows, even without Apache. Oh, when using Apache, you'd want the real path to perl.exe instead of /usr/bin/perl, since, as you know, Apache looks at the #! line.

I don't use warnings as that will prevent my code from compiling prior to Perl 5.6 and it is still way too early to yell at anyone for running pre-5.6 versions of Perl. (:

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: use warnings vs. perl -w
by $code or die (Deacon) on Jan 24, 2001 at 20:59 UTC
    You're right, it does work, but I just tried this:
    #!/usr/bin/perl -w print "Content-Type: text/html\n\n"; $t = "hello world"; print "$h, $t";
    It doesn't complain about $h being uninitialised. It does however, if you take out the HTTP header.

    Update: I was running this on a Win32 webserver.

    Is that the way it should be?

    $code or die
    Using perl at
    The Spiders Web
      If you are running under a webserver, the non-fatal errors my be hiding in the error log of your server or may even have been piped away to nothing, rather depends on the webserver. Check the error logs and see.

      $you = new YOU;
      honk() if $you->love(perl)

        When I want to capture my warnings while running programs under IIS, I open STDERR to a text log file and then look in there for information.

      For me it complains either way, as it should.

              - tye (but my friends call me "Tye")
      These days, the -w command line flag is usually replaced with the warnings pragma, as the latter is more flexible, and has scope that is limited to the enclosing block, while -w is global in effect.
Re: (tye)Re: use warnings vs. perl -w
by dug (Chaplain) on Jul 17, 2002 at 16:35 UTC

    And here I was thinking it was time to yell at people for not using 5.8.0 RC3 in production. For that matter, Sean O'Rourke has submitted a Perl6 grammar patch to Parrot. <grin>