use HTML::TreeBuilder;
$tree = HTML::TreeBuilder->new->parse_file("test.html");
use HTML::FormatText;
$formatter = HTML::FormatText->new(leftmargin => 0, rightmargin => 50);
print $formatter->format($tree);
or, more simply:
use HTML::FormatText;
my $string = HTML::FormatText->format_file(
'test.html',
leftmargin => 0, rightmargin => 50
);
HTML::FormatText is built on HTML::Formatter and documentation for that module applies to this - especially ``new'' in HTML::Formatter, ``format_file'' in HTML::Formatter and ``format_string'' in HTML::Formatter.
You might specify the following parameters when constructing the formatter:
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.