Henry Laxen > Syntax-Highlight-Mason-1.23 > Syntax::Highlight::Mason

Download:
Syntax-Highlight-Mason-1.23.tgz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 1.23   Source  

NAME ^

Syntax::Highlight::Mason - Perl extension to Highlight HTML::Mason code

SYNOPSIS ^

  use Syntax::Highlight::Mason;
  use IO::All;
  my $compiler = Syntax::Highlight::Mason->new();
  while (my $file = shift @ARGV) {
    my $source < io($file);
    print $compiler->compile($source);
  }

DESCRIPTION ^

Produce colorized and HTML escaped code from HTML::Mason source suitable for displaying on the WWW and perhaps even in an Mason environment. Lots of things are customizable, but the defaults are pretty reasonable.

Customization

The following items can be customized:

 $debug          Set it to 1 to enable debugging output
 $style_sheet    A CSS style sheet that maps HTML ids to colors
 $preamble       HTML that gets inserted at the beginning of a page
 $postamble      HTML that gets inserted at the end of a page
 $color_table    A mapping of perl syntax elements to colors
 @mason_highlight An array, element[0] is inserted before mason code
                            element[1] is inserted after mason code

These are all package Global variables, which you can just set to your own values if desired. A simple: $Syntax::Highlight::Mason::debug = 1; should do the trick.

Further Customization

More customization can be done by passing parmeters to the new() method if desired. You can set the preamble, postamble, and color_table parameters here too. In addition, you can specify your own callback subroutines which encode perl, html, plain (text), and mason code. The defaults use Syntax::Highlight::Perl::Improved for perl, Syntax::Highlight::HTML for HTML, HTML::Entities::encode for plain text, and bold blue HTML::Entities::encode for mason code.

$self->highlight($type,@args)

calls the apropriate callback subroutine set up in new() above, depending on the type of encoding (perl, html, plain, mason) to be performed. Output is collected for later. You could also subclass this if you wanted to generate your own highlighting

AUTHOR ^

Henry Laxen nadine.and.henry@pobox.com

SEE ALSO ^

Syntax::Highlight::HTML Syntax::Highlight::Perl::Improved HTML::Mason

syntax highlighting: