I really like my Perl code formatted – lines indented, etc. The problem is I hate doing it myself, and I really enjoy auto-formatters that do this automatically for you.
I work with Eclipse and the EPIC plugin does just that. The problem is that it does not handle comments very well. If comments are too long, it does not break them into multiple lines but simply shifts them to the beginning of the line, so the indention is not right at all.
Also, it keeps code lines about 80 characters long, which sometimes makes things ugly. From my school days I remember that too long line are bad, but now I wonder if perhaps it’s better to just leave long lines as-is.
What do you say? any suggestions on how to format my Perl code under Eclipse (or in general)?
UPDATE
Eclipse’s EPIC plugin also uses perl tidy. Any idea on how to make perl tidy break long code lines, but if it can’t (e.g. long string) still indent them as normal and allow them to be longer (instead of indenting them all the way to the left as is the default?
For a non IDE solution then have a look at
Perl::Tidy.This module is good at beautifying your Perl code into whatever style you have a preference with. However not sure that it has a long line/comment fixer though? (Disclaimer: I don’t use
Perl::Tidybecause I’m happy with the wayTextMate&Vi(m)handle my Perl code).For an alternative IDE solution then have a look at
Padre, the Perl Application Development and Refactoring Environment.Padreis self hosting (ie. written in Perl5), cross platform (useswxWidgetsfor GUI) and works with Perl5 & Perl6 (rakudo).Here are some videos:
/I3az/