[TriLUG] formatting (tabbing) perl scripts

Joseph Tate jtate at dragonstrider.com
Sat Apr 24 14:15:53 EDT 2004


Douglas Kojetin wrote:
> also, if anyone knows of anything that will work with C, tcl and python, 
> please pass along too!  (does not have to be the same script/program)
> 
> thanks,
> doug
> 
> On Apr 24, 2004, at 12:57 PM, Douglas Kojetin wrote:
> 
>> i've got a perl script with quite a bit of code.  i had to add a few 
>> more 'if/else' statements, and instead of manually tabbing everything 
>> over (puts ease on my eyes), i was wondering if there was a program 
>> and/or script that anyone knows of that might automagically do this 
>> for me (scan through the code and tab it according to its structure)?  
>> i've seen programs that format HTML quite efficiently (html tidy, i 
>> think it was called), but i haven't really looked for anything else.
> 
> 

astyle is my tool of choice (astyle.sourceforge.net).

Choose between K&R and ANSI standards via commandline switches.  I think 
you can even define your own formatting schemes.  It works well for 
C/C++ and Java, and probably works fine for Perl, so long as you don't 
have a lot of heredoc strings (<<<__EOT__), but I've not tried it with 
tcl or python.

Looks like there's a perltidy that was once packaged for debian.

Joseph




More information about the TriLUG mailing list