]>
Commit | Line | Data |
---|---|---|
1 | package TestUtils; | |
2 | ||
3 | use HTML::PrettyPrinter; | |
4 | use FileHandle; | |
5 | use File::Slurp; | |
6 | ||
7 | use Carp qw(carp cluck croak confess); | |
8 | ||
9 | require Exporter; | |
10 | @ISA=qw(Exporter); | |
11 | @EXPORT = qw(ptree html_dir); | |
12 | ||
13 | sub html_dir { | |
14 | 't/html/' | |
15 | } | |
16 | ||
17 | sub ptree { | |
18 | my $tree = shift or confess 'must supply tree'; | |
19 | my $out = shift or confess 'must supply outfile'; | |
20 | ||
21 | my $hpp = HTML::PrettyPrinter->new | |
22 | (tabify => 0, allow_forced_nl => 1, quote_attr => 1); | |
23 | my $lines = $hpp->format($tree); | |
24 | ||
25 | write_file $out, @$lines; | |
26 | join '', @$lines; | |
27 | } | |
28 | ||
29 | ||
30 | ||
31 | 1; |