Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Perl archeology: Need help in refactoring of old Perl code that does not use strict

by Monk::Thomas (Friar)
on Nov 14, 2017 at 12:14 UTC ( [id://1203365]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl archeology: Need help in refactoring of old Perl code that does not use strict
in thread Perl archeology: Need help in refactoring of old Perl code that does not use strict

This is what I would do after 'Step 0':

  • identify a function using a global variable.
  • verify the global variable does not change during execution of this function, e.g. some other function called by this function modifies it. (insert some code to do this for you)
  • convert global variable into an argument and update all callers.

If the variable does change during the run then pick a different function first. When you got the global state disentangled a bit it's a lot easier to reason about what this code is doing. Everything that's still using a global needs to be treated with very careful attention.

  • Comment on Re^2: Perl archeology: Need help in refactoring of old Perl code that does not use strict

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2024-04-23 21:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found