Beautifier - Perl extension for beautifying/styling/prettyprinting perl code.
use Beautifier; my $beautifier = new Beautifier; print $beautifier->Beautify( {'indent' => " "}, "$this = 'some perl code';\n"; );
This module pretty prints/beautifies perl code. It does 3 things: - Indenting - Spacing around () and = and so forth - Curly placing
This might come in handy when working on other people's code (don't you hate that?) It uses my coding conventions, like placing the curly on the next line. Feel free to change it to your style (which, if different from mine, is wrong ;) Here is what code will look like after it's been crunched by Beautifier:
if (($varName =~ m//) && (-f $fileName)) { print "Hello, world!\n"; }
WARNING: A working program might no longer work after Beautifier did her thing on it. (Beautifier is definitely female)
#!/usr/bin/perl -w use strict; use Beautifier; undef $/; ### To read file all in one swoop open (FH, "test.pl") || die $!; my $fileContent = <FH>; close (FH); $/ = "\n"; ### Back to default my $beautify = new Beautifier; print $beautify->Beautify( { 'indent' => " ", }, $fileContent );
Teun van Eijsden, <teun@chello.nl>
perl.
To install Beautifier, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Beautifier
CPAN shell
perl -MCPAN -e shell install Beautifier
For more information on module installation, please visit the detailed CPAN module installation guide.