Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^6: Backdating strict

by LanX (Saint)
on Nov 19, 2020 at 00:28 UTC ( [id://11123804]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Backdating strict
in thread Backdating strict

I just wanted to return to the topic on how an IDE can help refactoring to strict.

I agree that cperl's syntax highlighting is among the best.

But it can't help catching typos in variable-names or scoping problems. That's where flymake et al. comes very handy.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^7: Backdating strict
by jcb (Parson) on Nov 19, 2020 at 00:41 UTC

    I have never refactored code to use strict; because all of my code has been written under strict (command-line one-liners excepted), but when I have had typos in variable names, I have always had great success by simply running the script at a terminal and letting perl point out the errors.

    Since this is presumably functioning code, we can expect that there will be no variable-name typos. The simplest option for moving to strict would be to add use strict; and then use vars at top-level, listing the variables already used until all are declared. Narrowing the scopes to lexicals can then be done incrementally, using grep or Emacs' M-x occur to identify where each name is mentioned in the code and understanding of the program to determine where values can be reduced to narrower scopes.

      > I have always had great success by simply running the script at a terminal and letting perl point out the errors.

      You never tried flymake-mode, right? :)

      And why do you run it in a terminal instead of a compilation buffer?

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        Simple; the main reason I run X is to have dozens of xterms and Emacs frames scattered across my numerous virtual desktops with the occasional graphical application. Emacs is a better editor, but xterm is a better terminal. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11123804]
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: (5)
As of 2024-04-16 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found