Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: Why Perl Docs examples do not use strict and warnings often

by stevieb (Canon)
on Nov 20, 2021 at 23:27 UTC ( #11138990=note: print w/replies, xml ) Need Help??

in reply to Re: Why Perl Docs examples do not use strict and warnings often
in thread Why Perl Docs examples do not use strict and warnings often

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.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11138990]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2022-01-29 07:27 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (74 votes). Check out past polls.