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

Re^2: Backdating strict

by eyepopslikeamosquito (Archbishop)
on Nov 18, 2020 at 23:45 UTC ( [id://11123801]=note: print w/replies, xml ) Need Help??


in reply to Re: Backdating strict
in thread Backdating strict

You may well be right - and I see the redoubtable LanX agrees.

It depends though on how the original code was written, especially with regard to variable scope. If the original code follows the four simple rules in the Encapsulation section at On Coding Standards and Code Reviews, namely:

  1. Avoid non-const global variables.
  2. Minimize the scope of variables, pragmas, etc..
  3. Minimize the visibility of variables.
  4. Don't overload variables with multiple meanings.
you might be able to make the code strict-safe quicker than you think. Especially if it's already partitioned into modules with a unit test for each module.

To prove my point, I remember once coming back to a large module I'd originally written, only to fall off my chair when I noticed some clown had commented out the use strict line at the top of the file! Without a comment to explain why. BTW, On Commenting Out 'use strict;' shows I'm not alone in being scarred for life by this unpleasant experience.

Anyways, after picking myself up off the floor, I was pleasantly surprised to quickly repair this unfortunate act of code vandalism by restoring the use strict line and making only minor adjustments to the code. Admittedly, having the bulk of the code already strict-safe and having a unit test for the module certainly helped.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-24 22:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found