1

I have code that was previous formatted by perltidy. It has assignment operators aligned. How can I get perltidy to unalign the assignment operators. I've been all over the manual, trying and experimenting. Here's my current argument list:

-i=2 -nt -bt=2 -bbvt=0 -dws -asc -dsm -vt=2 -pt=2 -nwls='= =>' -wls='= =>' -sak='if elsif for while unless'

Note, what I want is -nwls='= =>' -wls='= =>', which is to say, delete all the whitespace left of the = or => operators, but then add one space to the left. I'm figuring that what I really need to do is just write a script that runs perltidy twice to remove the whitespace around =, then add it again.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
mike_haney
  • 545
  • 1
  • 8
  • 18
  • 6
    `=>` is not an assignment operator, it is the quoting comma. – Eric Strom Nov 29 '11 at 19:23
  • Could you provide an example of the alignment you have and the alignment you want? – Schwern Nov 29 '11 at 20:29
  • Maybe a patch like that one might help you: [How can I prevent PerlTidy from aligning assignments but keep adding single spaces?](http://stackoverflow.com/questions/4538209/how-can-i-prevent-perltidy-from-aligning-assignments-but-keep-adding-single-spac) – Karsten S. Nov 29 '11 at 21:49
  • thanks for the correction eric, got anything useful to add though? – mike_haney Nov 30 '11 at 03:10
  • i think i'm siding with brian on this one. i saw that patch karsten, but i'm using a perltidy binary, not Perl::Tidy or whatever the module was, but thanks anyways. – mike_haney Nov 30 '11 at 03:11
  • 2
    Don't you realise that [`perltidy`](http://p3rl.org/perltidy) is just a very small wrapper script around the [`Perl::Tidy` module](http://p3rl.org/Perl::Tidy)? Both are part of the `Perl-Tidy` distribution. – daxim Nov 30 '11 at 13:46

0 Answers0