views:

107

answers:

2

Hi, is there a possibility to make perltidy vertically align brackets like this:

$foo->bar                                (1);
$foo->bat                                (2);
$foo->bac                                (3);
$foo->bad                                (4);
$foo->bae                                (5);
$foo->baf                                (6);
$foo->bagofbones                         (7);
$foo-> what_a_strange_name_for_a_message ('but it must be so');

best, R.

+3  A: 

I have found it. In my .perltidyrc i had the --space-function-paren Option set.

$  perltidy --noprofile --space-function-paren <<EOF
> \$foo->bar (1);
> \$foo->bat (2);
> \$foo->bac (3);
> \$foo->bad (4);
> \$foo->bae (5);
> \$foo->baf (6);
> \$foo->bagofbones (7);
> \$foo-> what_a_strange_name_for_a_message ('but it must be so');
> EOF
$foo->bar                               (1);
$foo->bat                               (2);
$foo->bac                               (3);
$foo->bad                               (4);
$foo->bae                               (5);
$foo->baf                               (6);
$foo->bagofbones                        (7);
$foo->what_a_strange_name_for_a_message ('but it must be so');

Unfortunately i haven't found anything in perltidy's manual about vertical alignment while using -sfp, but i can live without it.

Thank you for help.

Robert
A: 

This is not a global answer, but if you have blocks of code that you don't want reformatted, use #<<< to start a section to ignore and #>>> to end the section to ignore:

#<<<  do not let perltidy touch this
    my @list = (1,
                1, 1,
                1, 2, 1,
                1, 3, 3, 1,
                1, 4, 6, 4, 1,);
#>>>

from http://search.cpan.org/~shancock/Perl-Tidy-20090616/bin/perltidy

molecules