Stories
Slash Boxes
Comments
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 ]

jk2addict (4946)

jk2addict
  (email not shown publicly)
http://today.icantfocus.com/blog/
AOL IM: chrislaco (Add Buddy, Send Message)
Yahoo! ID: chrislaco@sbcglobal.net (Add User, Send Message)
Jabber: laco@scribblewerks.com

Journal of jk2addict (4946)

Sunday April 06, 2008
09:13 PM

PerlTidy Kool-Aid is Poison

[ #36087 ]
The mantra sounds good to me: use tidy to format code the same, so changesets across users truely measure code changes, not code formatting changes. But try as I might, I just can't live with perltidy. No matter how many times I futz with options, it does what I want in some places, and completely makes no sense in other places. For example:

BEGIN {
    use base qw/Class::Accessor::Grouped/;
    use Class::Inspector ();
    use Scalar::Util ();
    use Mango::Exception ();

    __PACKAGE__->mk_group_accessors('component_class', qw/result_class/);
};

becomes

BEGIN {
    use base qw/Class::Accessor::Grouped/;
    use Class::Inspector ();
    use Scalar::Util     ();
    use Mango::Exception ();

    __PACKAGE__->mk_group_accessors('component_class',
        qw/result_class/);
}

Nice work on the parans...but no reason to break that next line at all. -nanl fixes this problem, but leaves other lines of source way pas 80 columns. Sure, in this case, I can move qw/result_class/ to 'result_class' to avoid the formatting issue, but in other similiar code with more than on item in the qw//, it does the same thing. This is just one example of many issue I have. Things like stacking and not stacking closings. Somtimes it works. Sometimes, I get this:

sub delete {
    my $self = shift;

    return $self->meta->provider->delete_attributes(
        $self->meta->parent,
        {id => $self->id}
    );
};

turned into this:

sub delete {
    my $self = shift;

    return $self->meta->provider->delete_attributes($self->meta->parent,
        {id => $self->id});
}

Not an improvement in my book. My current setting work about 60% of the time. The rest of the time, the output seems worse to me.

-l=72
-i=4
-ci=4
-bar
-ce
-nsbl
-sot
-sct
-pt=2
-sbt=2
-bt=2
-bbt=2
-nsfs
-asc
-dsm
-nbbb

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I remember fighting code formatting standards too, in the dark years before perltidy. Now, I'm happy to trade my perfect formatting for perltidy's mostly right formatting, simply because it's so much better than how every other person formats their code. Since I'm the only programmer in the world who can format things correctly, I figure that perltidy will at least make other people's code legible for me.

    I sympathize with you on the list indentation, but I think your desire to have a line here and there

    • True. In the end, it's goin to be a matter of learning to worry about what the code does, and leave how it 'reads' to tindy and moving on with life.