Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Perl Tidy Question

by jk2addict (Chaplain)
on Jan 11, 2008 at 17:34 UTC ( [id://661929]=perlquestion: print w/replies, xml ) Need Help??

jk2addict has asked for the wisdom of the Perl Monks concerning the following question:

I confess, I like ending all ifs/elses/subs with a semicolon. Call me a semicolon purist. Maybe it's that I do so much perl/c#/javascript that I just like being more consistent everywhere.

if (...) { }; sub foo { if (...) { }; };

I'm trying perltidy...again, and quickly I start banging my head. When I add -ndsm to my rc, I get this:

if (...) { } ; sub foo { if (...) { } ; };

My current rc is:

-l=78 -i=4 -ci=4 -bar -ce -nsbl -sot -sct -pt=2 -sbt=2 -bt=2 -bbt=2 -nsfs -asc -ndsm

I'm sure there's no way to get what I want on this either:

$foo->bar( $self->this($that, $other) );

When using object->method as method params, I like the indent, otherwise, just put the params on the same line in ().

$foo->bar($this, $that);

How do I beat perltidy into submission?

Replies are listed 'Best First'.
Re: Perl Tidy Question
by Fletch (Bishop) on Jan 11, 2008 at 19:44 UTC

    Not to answer your question but rather offer up a personal aesthetic opinion: Bleh. :)

    Again not saying it's "wrong", but that just looks . . . well, wrong. :) There's all the complains that Perl is line noise and this style just adds in extra unnecessary characters in meaningless places. Semis terminate simple statements (e.g. EXPR ;), but you're placing them after constructs that are in and of themselves complete statements.

    It's not as bad as this stuff, but on a scale of 1 to 10 yours raises the hackles to about a 4.5923 ("perlish" would be about a 9, just for comparison :).

    Then again I work with people who insist on Whitesmiths and I haven't gone completely nutters yet so . . . :)

    Again, a big disclaimer: the preceding is just opinion; good luck wrangling perltidy (you malformatting heathen :).

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      There was a time when I thought I was the only person who used Whitesmiths. Then I found out I wasn't alone. In fact, I was in good company. But most disappointingly, I hadn't invented it.

      By the way, anybody have Perl Tidy configs that will output Whitesmiths?

      Cheers,

      Brent

      -- Yeah, I'm a Delt.

        This is what we use to get things to our local whitesmiths-y variant (I've of course got another version that puts things back to a proper form so I can read them . . . :)

        --nocheck-syntax --warning-output --maximum-line-length=78 --indent-columns=3 --continuation-indentation=3 --indent-closing-paren --nooutdent-long-lines --nooutdent-labels --space-for-semicolon --brace-left-and-indent --brace-left-and-indent-list="if elsif else unless for foreach sub whi +le until do continue : BEGIN END CHECK INIT AUTOLOAD DESTROY" --paren-vertical-tightness=1 --paren-vertical-tightness-closing=1 --square-bracket-vertical-tightness=1 --square-bracket-vertical-tightness-closing=1 --brace-vertical-tightness=1 --brace-vertical-tightness-closing=1 --line-up-parentheses --break-at-old-comma-breakpoints --long-block-line-count=2 --maximum-consecutive-blank-lines=2 -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= && += -= /= |= >>= ||= .= %= ^= x="

        The cake is a lie.
        The cake is a lie.
        The cake is a lie.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-26 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found