Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: perltidy IF continuation indentation

by sauoq (Abbot)
on Oct 04, 2005 at 14:05 UTC ( #497250=note: print w/ replies, xml ) Need Help??


in reply to perltidy IF continuation indentation

Well, I don't know what switches if any will give that behavior, but if you simply put parens around your clause, it'll indent nicely by default.

-sauoq
"My two cents aren't worth a dime.";


Comment on Re: perltidy IF continuation indentation
Re^2: perltidy IF continuation indentation
by jaa (Friar) on Oct 04, 2005 at 15:26 UTC
    Interesting observation!

    I have set my perltidy options to the ones in Damian Conway's 'Perl Best Practices', and with these, adding the brackets makes no difference.

    A bit of experimentation shows that this is because I have -i=2 and -ci=2. I have both the indent and continuation-indent settings set to the same value.

    Without brackets, perltidy simple inserts a series of continuation-indents.

    Add the brackets, and perltidy inserts a continuation-indent in front of the IF and then, recognising the presence of a container (the brackets) adds full indents as it wraps the container content.

    The observation is much appreciated, as it has lead me to a better understanding of perltidy, but sadly doesn't really help. :(

    Is anyone else going to use the PBP style? Do you just live with the ugliness of continuation-indent IFs?

    Regards,

    Jeff

      Is anyone else going to use the PBP style?

      Not if it makes my code look like that! ;-)

      I might be able to live with continuation-indent set to 1 instead of 2 though. As shown below, the perltidy documentation suggests that it should be no greater than that if -i=2.

      When default values are not used, it is suggested that the value n given with -ci=n be no more than about one-half of the number of spaces assigned to a full indentation level on the -i=n command.

      -sauoq
      "My two cents aren't worth a dime.";
      

        Yes - I have seen the man page for -i and -ci. Having used the perlstyle guidelines for a few years, we are finding it an adjustment (we miss our cuddled elses!) :) but it does seem to have a certain internal consistency. One thing we do really like is the new cascading trinary operator layout. We used to just use whatever seemed right at the time.

        Which specific part of PBP style don't you like - and for what reason?

        Regards,

        Jeff

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2014-07-24 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (160 votes), past polls