Congradulations! You reinvented
Perl::Tidy. :)
use strict;
use warnings;
use Perl::Tidy;
use CGI qw(:standard);
open FH, '<', '/path/to/perlfile.pl' or die $!;
my $content = do {local $/;<FH>};
my $html;
perltidy(
source => \$content,
destination => \$html,
argv => '-html -npod -css=/path/to/perltidy.css',
errorfile => '/dev/null',
);
print header,
start_html(
-title => 'Colorized Perl',
-style => { src => '/URL/to/perltidy.css' },
),
$html,
end_html,
;
Here is my
perltidy.css file
should you want to use it.