At work we've recently tried to agree on a set of perltidy rules. We came up with these:
-i=4 # 4 character indents in blocks
-pt=2 # "horizontal tightness"
-wls='=>' # ensure there's always space to the left of =>
-wrs='=>' # and always to the right of =>
-vtc=0 # always break before a closing token
-l=79 # 79 characters wide please
-nolc # no "outdenting" for long comments - indent them properly
-nolq # no "outdenting" for long quotes/strings
-sot # stack opening tokens - same as -sop -sohb -sosb
-sct # stack closing tokens
But they seem to result in unexpected changes like this:
- error(300) if $@; # 300 = GSI_BAD_ID
+ error(300) if $@; # 300 = GSI_BAD_ID
and this:
my $d;
$d->{status} = 'queued';
$d->{description} = 'The action was successfully queued';
- $d->{id} = '12345'; # Identifies action request
+ $d->{id} = '12345'; # Identifies action request
So my questions are:
1) What's the point of these changes?
2) Which options control them?
I read the docs but did not find anything relevant:
http://perltidy.sourceforge.net/perltidy.html#formatting_options
http://perltidy.sourceforge.net/stylekey.html
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.