Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Your Favorite Options for Perltidy

by ambrus (Abbot)
on Nov 05, 2005 at 15:56 UTC ( #505994=note: print w/replies, xml ) Need Help??

in reply to Your Favorite Options for Perltidy

I don't use perltidy. I do the formatting by hand, with some help from the editor.

Replies are listed 'Best First'.
Re^2: Your Favorite Options for Perltidy
by vek (Prior) on Nov 06, 2005 at 07:36 UTC

    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 line 1102, at end of +line syntax error at 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 --

      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.

      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 Please see file! shell>view

        -- vek --

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2020-06-01 16:07 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (3 votes). Check out past polls.