Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Your Favorite Options for Perltidy

by ambrus (Abbot)
on Nov 05, 2005 at 15:56 UTC ( [id://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 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 --

      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 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://505994]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-28 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found