6 use Syntax::Highlight::Perl;
9 'Variable_Scalar' => 'color:#080;',
10 'Variable_Array' => 'color:#f70;',
11 'Variable_Hash' => 'color:#80f;',
12 'Variable_Typeglob' => 'color:#f03;',
13 'Subroutine' => 'color:#980;',
14 'Quote' => 'color:#00a;',
15 'String' => 'color:#00a;',
16 'Comment_Normal' => 'color:#069;font-style:italic;',
17 'Comment_POD' => 'color:#014;font-size:11pt;',
18 'Bareword' => 'color:#3A3;',
19 'Package' => 'color:#900;',
20 'Number' => 'color:#f0f;',
21 'Operator' => 'color:#000;',
22 'Symbol' => 'color:#000;',
23 'Keyword' => 'color:#000;',
24 'Builtin_Operator' => 'color:#300;',
25 'Builtin_Function' => 'color:#001;',
26 'Character' => 'color:#800;',
27 'Directive' => 'color:#399;font-style:italic;',
28 'Label' => 'color:#939;font-style:italic;',
29 'Line' => 'color:#000;',
32 my $formatter = Syntax::Highlight::Perl->new();
34 $formatter->define_substitution(
40 while ( my ( $type, $style ) = each %{$color_table} ) {
41 $formatter->set_format(
44 qq|<span style="$style">|,
50 my $file = shift || die "Give me a perl file to colorize!\n";
51 -e $file or die "There's no such file: $file\n";
53 open F, '<', $file or die $!;
55 print '<pre style="font-size:10pt;color:#336;">';
57 print $formatter->format_string;