NAME
XML::Filter::PerlTidy - SAX filter through Perl::Tidy
SYNOPSIS
my $h = SomeHandler->new;
my $f = XML::Filter::PerlTidy->new( Handler => $h );
my $p = SomeParser->new( Handler => $f );
$p->parse;
DESCRIPTION
my $filter = XML:Filter::PerlTidy->new(
Handler => $some_handler,
tidy_element => 'perl',
tidy_argv => [ qw(-html -pre -se -nss -nsyn) ],
);
Create a new instance of the filter. As with any SAX filter, you must provide a Handler
which will receive the filter's output.
tidy_element
is the name of the element in the XML element whose contents should be filtered through Perl::Tidy. It default to perl, meaning that all character data within <perl> ... </perl> containers will be filtered.
tidy_argv
an anonymous array of options that are passed to Perl::Tidy's perltidy
function. It defaults to [ qw(-html -pre -se -nss -nsyn) ]. XML::Filter::PerlTidy will work only if Perl::Tidy's output is valid XML, with all data included in a single root element. Therefore it is advised to provide at least the '-html -pre' options.
XML::Filter::PerlTidy automatically calls XML::Filter::BufferText to coalesce character data so that a complete element is fed to PerlTidy.
AUTHOR
Eric Cholet
CREDITS
Robin Berjon for taking the time to teach me SAX basics.
SEE ALSO
COPYRIGHT
The XML::Filter::PerlTidy module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.