colleague asked me how to make perltidy align all fat commas in a hash.
The ternary in the following example seems to block alignment
#!/usr/bin/perl use strict; use warnings; sub test { my ( $result, $data, $date ); return { res => 1 ? 1 : 0, errtext => $result->{errtext}, info => $data, timestamp => ( $date->dmy('-') . ' ' . $date->hms ), }; }
>perltidy -pbp tidy_align.pl #!/usr/bin/perl -w use strict; use warnings; sub test { my ( $result, $data, $date ); return { res => 1 ? 1 : 0, errtext => $result->{errtext}, info => $data, timestamp => ( $date->dmy('-') . ' ' . $date->hms ), }; }
FWIW adding another entry before the ternary seems to make it work again.
Browsed thru documentation couldn't find a flag addressing this, not sure which term is used for "alignment" of values in recursive structures.
Looks like a bug for me ... ideas?
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
In reply to Perltidy alignment of fat comma => by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |