Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Friday January 13, 2006
02:23 PM

Give up on perltidy?

[ #28344 ]

After no one was able to answer this question about perltidy formatting, I'm at the verge of never using it again. I've read through the perltidy docs, made sure I had the latest version, checked out other people's perltidyrc files and it all comes down to this:

my %hash = (
    some_long_key => {
        INCLUDE_PATH => __PACKAGE__->path_to('www/templates/tt')

I want that to remain unchanged. No matter what perltidyrc I try, I can't seem to do that even though that looks like a pretty standard way of formatting that. Theory (my boss) has the same problem. We really don't want to spend a lot of time on stupid stuff like this because whether or not an else is cuddled doesn't pay the bills. However, whether or not the code is readable makes a difference in how fast one can understand the code. Aesthetic considerations may sound silly, but they really do matter.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I never use perltidy on my own code, but I use it in other people's code. ;-) While perltidy and I may not agree 100% of the time, it's at least >95%. Some people's coding style agree with mine 0%!
  • Seems to do the trick...
    • If you run perltidy on this:

      my %hash = (
          some_long_key => {
              INCLUDE_PATH => __PACKAGE__->path_to('www/templates/tt')

      ... and it doesn't change, then it's something else you're doing. Those two options by themselves generate this:

      my %hash =
      ( some_long_key =>
          { INCLUDE_PATH => __PACKAGE__->path_to('www/templates/tt') } );

  • This works for me: perltidy -l=64 -i=4
  • I added an empty comment and it started working with just -i=4.
    my %hash = (
        some_long_key => {
            INCLUDE_PATH => __PACKAGE__->path_to('www/templates/tt')    #