File Coverage

blib/lib/Pod/Elemental/Node.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Pod::Elemental::Node 0.103006;
2             # ABSTRACT: a thing with Pod::Elemental::Nodes as children
3              
4 13     13   6648 use Moose::Role;
  13         36  
  13         100  
5              
6 13     13   59350 use namespace::autoclean;
  13         30  
  13         86  
7              
8 13     13   2192 use MooseX::Types;
  13         93227  
  13         106  
9 13     13   52446 use MooseX::Types::Moose qw(ArrayRef);
  13         179455  
  13         103  
10              
11             requires 'as_pod_string';
12             requires 'as_debug_string';
13              
14             #pod =head1 OVERVIEW
15             #pod
16             #pod Classes that include Pod::Elemental::Node represent collections of child
17             #pod Pod::Elemental::Paragraphs. This includes Pod documents, Pod5 regions, and
18             #pod nested Pod elements produced by the Gatherer transformer.
19             #pod
20             #pod =attr children
21             #pod
22             #pod This attribute is an arrayref of
23             #pod L<Pod::Elemental::Node|Pod::Elemental::Node>-performing objects, and represents
24             #pod elements contained by an object.
25             #pod
26             #pod =cut
27              
28             has children => (
29             is => 'rw',
30             isa => ArrayRef[ role_type('Pod::Elemental::Paragraph') ],
31             required => 1,
32             default => sub { [] },
33             );
34              
35             around as_debug_string => sub {
36             my ($orig, $self) = @_;
37              
38             my $str = $self->$orig;
39              
40             my @children = map { $_->as_debug_string } @{ $self->children };
41             s/^/ /sgm for @children;
42              
43             $str = join "\n", $str, @children;
44              
45             return $str;
46             };
47              
48             1;
49              
50             __END__
51              
52             =pod
53              
54             =encoding UTF-8
55              
56             =head1 NAME
57              
58             Pod::Elemental::Node - a thing with Pod::Elemental::Nodes as children
59              
60             =head1 VERSION
61              
62             version 0.103006
63              
64             =head1 OVERVIEW
65              
66             Classes that include Pod::Elemental::Node represent collections of child
67             Pod::Elemental::Paragraphs. This includes Pod documents, Pod5 regions, and
68             nested Pod elements produced by the Gatherer transformer.
69              
70             =head1 PERL VERSION
71              
72             This library should run on perls released even a long time ago. It should work
73             on any version of perl released in the last five years.
74              
75             Although it may work on older versions of perl, no guarantee is made that the
76             minimum required version will not be increased. The version may be increased
77             for any reason, and there is no promise that patches will be accepted to lower
78             the minimum required perl.
79              
80             =head1 ATTRIBUTES
81              
82             =head2 children
83              
84             This attribute is an arrayref of
85             L<Pod::Elemental::Node|Pod::Elemental::Node>-performing objects, and represents
86             elements contained by an object.
87              
88             =head1 AUTHOR
89              
90             Ricardo SIGNES <cpan@semiotic.systems>
91              
92             =head1 COPYRIGHT AND LICENSE
93              
94             This software is copyright (c) 2022 by Ricardo SIGNES.
95              
96             This is free software; you can redistribute it and/or modify it under
97             the same terms as the Perl 5 programming language system itself.
98              
99             =cut