30 October 2004
This post may be outdated due to it was written on 2004. The links may be broken. The code may be not working anymore. Leave comments if needed.
Perltidy is a tool to indent and reformat perl scripts. It can also write scripts in html format.
Homepage:http://perltidy.sourceforge.net

Install

download PerlTidy-20031021,
perl Makefile.PL
(n)make test
(n)make install
如果(n)make不成功的话,可以如下:
  • 将lib目录中的Perl/Tidy.pm copy to $Perl/site/lib, 将bin目录下的perltidy copy to $Perl/lib. run
    $Perl\bin>perl perltidy testfile.pl
    
  • 查看 pm2pl 文件,发现此程序将Tidy.pm与perltidy合并为一个新的 perltidy - Perl 文件
    >perl pm2pl testfile.pl
    
down来的包里有个目录为examples, 里面有些Script是值得一看的。

Usage

perltidy -html testfile.pl
此命令可生成已着色的HTML文件。
虽然颜色可能不是很让人满意,但可以改其中的CSS style或通过增加-css=mystyle.css选项来添加自己的css.
还有很多不错的选项如-nnn, 查阅perldoc Perl::Tidy获得更多帮助。


blog comments powered by Disqus