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