Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

FYI, I use "#!/usr/bin/perl -w" even on Windows. I like to have Perl scripts that you can simply copy to a new system and have them work without modifications. So I also consider a system that has Perl but doesn't have a /usr/bin/perl to be broken (I make an exception for Win32 systems if they are not using Perl for CGI under Apache).

I also usually use "-w" even though "use warnings" is finally getting old enough that I'm surprised when I find a version of Perl that doesn't have warnings.pm. Why?

Well, first, I don't really recommend enabling any warnings in "production" situations unless you've done the work to get the warnings delivered to the people writing the code instead of to the people trying to use the code. Many warnings are run-time and can be triggered in production even though they were never triggered during development and testing. They can even become a serious nuisance out of the blue.

So, if you haven't done the work to reroute warnings to developers, then I recommend "#!/usr/bin/perl -X" in production environments as this disables all warnings, even in code that has declared "use warnings".

And I strongly recommend enabling warnings during development and testing. So much so that I think you should at least occasionally test with "-W" so that you see warnings even for modules (or other scopes) that have declared "no warnings". It can be educational.

So I always start out with "#!/usr/bin/perl -w" so I can see warnings in any modules where the author hasn't declared "I know this gives warnings but they don't seem important" (by using "no warnings"). If that gets me warnings in some module that I can't be bothered to investigate further, then I might switch from "-w" to "use warnings".

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

In reply to (tye)Re: #!/usr/bin/perl -w by tye
in thread #!/usr/bin/perl -w by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-03-19 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found