/ domm

I hack Perl for fun and
profit.

Follow me on twitter!
Atom Icom ... on Atom!
<<<<<<<<<<
10.07.2009: $me->sleep(604800)
02.07.2009: Need for Speed Part I: DBIx::Class vs DBI
29.06.2009: looking for CPANTS (co-) maintainers
10.06.2009: Vienna.pm donates 2.500 Euro to YEF
09.06.2009: perltidy help needed

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?

Original: http://use.perl.org/~domm/journal/39106

Comments (via disqus)

09.06.2009: Vienna.pm funds Patrick R. Michaud one Rakudo-Day a week
02.06.2009: flash from the past
21.05.2009: Spending money to help Perl?
15.05.2009: Acme::ReturnValues is back
04.05.2009: Module::Install hate
>>>>>>>>>>