Search code examples
perlformattingperl-tidy

How can perltidy align the opening parenthesis for method arguments?


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.


Solution

  • 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.