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 ]

domm (4030)

domm
  (email not shown publicly)
http://domm.plix.at/

Just in case you like to know, I'm currently full-time father of 2 kids, half-time Perl hacker, sort-of DJ, bicyclist, no longer dreadlocked and 33 years old

I'm also head of Vienna.pm [pm.org], maintainer of the CPANTS [perl.org] project, member of the TPF Grants Commitee [perlfoundation.org] and the YAPC Europe Foundation [yapceurope.org].

I've got stuff on CPAN [cpan.org], held various talks [domm.plix.at] and organised YAPC::Europe 2007 in Vienna [yapceurope.org].

Journal of domm (4030)

Tuesday June 09, 2009
02:28 PM

perltidy help needed

[ #39106 ]

As we all know, perltidy is a very cool and powerful tool, and I love it. But there's one thing I cannot get it to do, which is best explained as code...

I would like to get this as a result:

$self->do_something( $c, {
    rs              => $c->model('DB::Foo')->search( { bar => 'baz' } ),
    fluxcompensator => '1.21 jigowatts',
});

Specifically, I want the ( $c, { on the same line and the contents of the hash only indented on level deeper.

I played around with a lot of settings, but could only get this:

$self->do_something(
    $c, {
        rs              => $c->model('DB::Foo')->search( { bar => 'baz' } ),
        fluxcompensator => '1.21 jigowatts'
    });

using

--stack-opening-tokens
--stack-closing-tokens
--opening-brace-always-on-right
--opening-token-right

I also tried --line-up-parentheses like this (additional to the above options):

--line-up-parentheses
--closing-token-indentation=0
--vertical-tightness=2

with this result:

$self->do_something( $c, {
                        rs =>
                            $c->model('DB::Foo')->search( { bar => 'baz' } ),
                        fluxcompensator => '1.21 jigowatts'
                     } );

Now the $c and { line up, but I do not like the fact that rs=> etc is indented that much.

So, dear lazyweb: What's the right perltidy setting? Or does perltidy simply not support my favourite coding style?

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.