Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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

by Anonymous Monk
on Nov 20, 2021 at 13:54 UTC ( #11138977=note: print w/replies, xml ) Need Help??

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

Just to make it clear, I have no intention of trolling Perl. Though I've used it infrequently, the language has helped me a lot. It's the only language I use, and since I'm not a developer, I don't have time to learn another language. Perl does everything I need. Just needed to bring up what I observed. My foremost apologies if my question appears as if I'm trolling, but that is most certainly not my intention.
  • Comment on Re: Why Perl Docs examples do not use strict and warnings often

Replies are listed 'Best First'.
Re^2: Why Perl Docs examples do not use strict and warnings often
by stevieb (Canon) on Nov 20, 2021 at 23:27 UTC

    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://11138977]
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: (2)
As of 2022-05-21 12:28 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (76 votes). Check out past polls.