/ domm

I hack Perl for fun and
profit.

Atom Icom Follow me on Atom!
<<<<<<<<<<
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
25.04.2009: seeking git wisdom: to squash or not to squash
23.04.2009: Lession of the day: Don't always do what the customer wants
06.04.2009: the rally season is on
29.01.2009: Vienna.pm continues to fund Jonathan Worthington in 2009
>>>>>>>>>>