Take the 2-minute tour ×

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)?


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?

share|improve this question
re: 80 chars line - I aim to keep my code below 80 chars but I'd go mad if my IDE enforced it! (TextMate & VIM have optional word wrap... but I have these switched off). –  draegtun Sep 16 '10 at 9:01
Re: Perl::Tidy - Only lines that can be broken apart are broken if you set that option. E.g., long string constants and comments are not broken apart but may be outdented. Perl::Tidy reformats your code, it does not add (non-whitespace) code. Breaking apart such things would require extra code. –  runrig Sep 16 '10 at 14:48
RE: 80 lines, the only reason there's anything special about 80 lines is because IBM paper punch cards had 80 lines. Why anyone would want to be held captive that that stupid and arbitrary limitation is beyond me. I also don't flog my sports car with a buggy whip to make it go faster!!! –  user2548100 Oct 23 '13 at 21:00

3 Answers 3

up vote 9 down vote accepted

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::Tidy because I'm happy with the way TextMate & Vi(m) handle my Perl code).

For an alternative IDE solution then have a look at Padre, the Perl Application Development and Refactoring Environment.

Padre is self hosting (ie. written in Perl5), cross platform (uses wxWidgets for GUI) and works with Perl5 & Perl6 (rakudo).

Here are some videos:


share|improve this answer

It looks like Eclipse/EPIC actually uses Perl::Tidy as its source formatter. Perl::Tidy is extremely flexible, so you probably just need to check the docs and set the options the way you want them.

The EPIC guide to setting those options: http://www.epic-ide.org/guide/ch02s04.php

share|improve this answer
Acvtually, it doesn't support my own formatting style: one feature is missing. But I use it anyway. –  reinierpost Sep 17 '10 at 9:00

As stated in other answers, the Eclipse/EPIC source formatter uses Perl::Tidy. Reference both the EPIC guide & the Perl::Tidy guide.

http://www.epic-ide.org/guide/ch02s04.php http://perltidy.sourceforge.net/perltidy.html#formatting_options

Or the short answer, in the EPIC Source Formatting preferences, use -l 132 to change the line length to 132.

share|improve this answer

Your Answer


