I've recently become a PerlTidy fiend since I stumbled upon the hotkey in my IDE that runs it over my working file. Now I not only compulsively save my work, I also compulsively format it. Seriously, my compulsive saving habit is so bad that I have hit Ctrl+S at least twice while composing this post. No, I do not want to save this HTML page, thank you. Hooray for being both paranoid and OCD!

Anyway, optionless PerlTidy doesn't always quite get things formatted to my coding style and occasionally makes some inexplicable decisions. Fortunately, this is rare and PerlTidy and I agree on most aspects of Perl code formatting style.

Which brings me to my reason for posting. I have run into a formatting issue that just drives me bonkers and I want to find the right PerlTidy option(s) to fix it, as my IDE so graciously allows me to specify them in my preferences. A caricature of the code pre- and post-tidying follows:

#! perl -w # my preferred format use strict; my @bar = qw(nagas are snake people); my @zelgo = qw(of course); my @mer = qw(gosh a third nested loop); for my $foo (@bar) { for my $bie (@zelgo) { for my $bletch (@mer) { my $do = bless {}, 'stuff'; $do->DOES(['data', 'data', 'dataaaaaa', 'dataaaaaaaaaaaa' +]) or die "this is a stupidly long die message as you can s +ee from its length\n"; } } }
#! perl -w # after PerlTidy - curious formatting decision use strict; my @bar = qw(nagas are snake people); my @zelgo = qw(of course); my @mer = qw(gosh a third nested loop); for my $foo (@bar) { for my $bie (@zelgo) { for my $bletch (@mer) { my $do = bless {}, 'stuff'; $do->DOES( [ 'data', 'data', 'dataaaaaa', 'dataaaaaaaaaaaa +' ] ) or die "this is a stupidly long die message as you can see from its length\n" ; } } }

I suppose that the difference is not glaring when shown in codeblocks in a forum post. But boy does it drive me crazy what PerlTidy is doing with that long die message. Okay, I can live with PerlTidy wanting to dictate line length, but what fresh hell prevents it from aligning that string on the new line with... at the very least, the innermost enclosing for loop? Ideally, it would be aligned with the or die on the previous line. And what's up with that dangingly (aligned properly, at least!) semi-colon? C'mon, it does not need its own line.

I have examined the PerlTidy docs but there's an awful lot there and I just can't seem to think of how to word my problem so that I can find the proper option for correcting this annoyance.

I'm sure some kind monk has encountered this and has parsed the docs far better than I. Hopefully he or she is willing to share the PerlTidy option(s) necessary to make my code look pretty again? And if not... well, I need to be less OCD anyway.


In reply to need help divining PerlTidy option by temporal

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.