Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

For years, I claimed I was not a developer. For the same years, I used primarily Perl for the same reason you do.

Your observation is valid and appreciated. I too find it conflicting when I see statements like "Always do X and Y", but then the examples don't follow suit. I suppose some of us take for granted the things we've ingrained our neural pathways with.

One of the fortunate, yet unfortunate long-standing design aspects of Perl was and has been to keep backward compatibility at the forefront of importance. For this reason, strict isn't enabled by default. It's up to us to remember to do so. When a newcomer comes along and doesn't see that in all examples, I can understand it being something easy to forget. To people like me who have been coding in Perl for a couple of decades, it's like remembering to put butter on my toast.

I think that all examples in Perl documentation may be better served by having the strict (and possibly warnings) lines, if every document doesn't make that clear in the intro explicitly. Unfortunately, I have not the time to make those changes to all documentation, so I'm not going to say it "should" be done.

The best we can do as a compromise as far as I see, is continue informing people the importance of such mechanisms, and reminding them why they exist (and in some cases, why they aren't set by default). It's new coders like you who notice these important conflicts and acknowledge them that allows us all to renew conversation on the matter, so other new coders can see, understand and learn.

Safe programming can be done without use strict; and use warnings;, but there's not a single file of Perl code I've ever written, deployed or published that don't have those two lines at the top.

Good question.

-stevieb


In reply to Re^2: Why Perl Docs examples do not use strict and warnings often by stevieb
in thread Why Perl Docs examples do not use strict and warnings often 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 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? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2022-05-28 14:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (99 votes). Check out past polls.

    Notices?