Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Your Favorite Options for Perltidy

by vek (Prior)
on Nov 06, 2005 at 07:36 UTC ( #506088=note: print w/replies, xml ) Need Help??


in reply to Re: Your Favorite Options for Perltidy
in thread Your Favorite Options for Perltidy

Perltidy can also be used for other things than code formatting. In fact, it can be bloody helpful. Take the following heartsinking error message:

Missing right curly or square bracket at ccpd.pl line 1102, at end of +line syntax error at ccpd.pl line 1102 at EOF
Bugger. So where is the missing curly brace? Dunno. Have no fear, for Perltidy will tell me in the error file it creates.
The most recent un-matched '{' is on line 567 567: sub createAuthMessage {
Now that rocks.

-- vek --

Replies are listed 'Best First'.
Re^3: Your Favorite Options for Perltidy
by ambrus (Abbot) on Nov 06, 2005 at 10:42 UTC

    An editor can help there too: I jump to the EOF where the error appears, insert a closing brace, and jump to the matching brace.

    However, an even more efficent way to find the missing braces is when the interpreter guesses its place from the indentation of the code (even though the indentation has no semantical meanning). The MzScheme interpreter can do this, and usually guesses right. (I hope perl6 will be able to do this too.) If, however, you reformat the code with an indenter, then the indents will follow the braces you've put there, not the way you think the code should be indented, so then indentation can't provide a clue to the interpreter.

Re^3: Your Favorite Options for Perltidy
by Anonymous Monk on Nov 06, 2005 at 11:49 UTC
    That rocks indeed! What command do you use to generate that last message? And in what environment?

      You don't need a special command. Perltidy will create an error file.

      shell>perltidy ccpd.pl Please see file ccpd.pl.ERR! shell>view ccpd.pl.ERR

      -- vek --

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2020-06-01 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (5 votes). Check out past polls.

    Notices?