File Coverage

blib/lib/Forest/Tree/Writer/SimpleHTML.pm
Criterion Covered Total %
statement 12 12 100.0
branch 4 4 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 21 21 100.0


line stmt bran cond sub pod time code
1             package Forest::Tree::Writer::SimpleHTML;
2 4     4   8867 use Moose;
  4         12  
  4         41  
3              
4             our $VERSION = '0.10';
5             our $AUTHORITY = 'cpan:STEVAN';
6              
7             with 'Forest::Tree::Writer',
8             'Forest::Tree::Roles::HasNodeFormatter';
9              
10             sub as_string {
11 5     5 1 16 my ($self) = @_;
12              
13 110         276 return join( "", map { "$_\n" }
14             $self->tree->fmap_cont(sub {
15 55     55   187 my ( $t, $cont, %args ) = @_;
16              
17             return (
18 160         605 ( $t->has_node ? ( '<li>' . $self->format_node($t) . '</li>' ) : () ),
19 55 100       2373 ( $t->child_count ? ( '<ul>', ( map { " $_" } $cont->() ), '</ul>' ) : () ),
    100          
20             );
21 5         350 }),
22             );
23             }
24              
25             __PACKAGE__->meta->make_immutable;
26              
27 4     4   50416 no Moose; 1;
  4         12  
  4         35  
28              
29             __END__
30              
31             =pod
32              
33             =head1 NAME
34              
35             Forest::Tree::Writer::SimpleHTML - A simple HTML writer for Forest::Tree heirarchies
36              
37             =head1 DESCRIPTION
38              
39             This is a simple writer which draws a tree as an HTML unordered list.
40              
41             =head1 METHODS
42              
43             =over 4
44              
45             =item B<as_string>
46              
47             =back
48              
49             =head1 BUGS
50              
51             All complex software has bugs lurking in it, and this module is no
52             exception. If you find a bug please either email me, or add the bug
53             to cpan-RT.
54              
55             =head1 AUTHOR
56              
57             Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
58              
59             =head1 COPYRIGHT AND LICENSE
60              
61             Copyright 2008-2014 Infinity Interactive, Inc.
62              
63             L<http://www.iinteractive.com>
64              
65             This library is free software; you can redistribute it and/or modify
66             it under the same terms as Perl itself.
67              
68             =cut