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;
2             # ABSTRACT: a thing with Pod::Elemental::Nodes as children
3             $Pod::Elemental::Node::VERSION = '0.103005';
4 13     13   7605 use Moose::Role;
  13         37  
  13         110  
5              
6 13     13   69665 use namespace::autoclean;
  13         34  
  13         109  
7              
8 13     13   2661 use MooseX::Types;
  13         107265  
  13         124  
9 13     13   61141 use MooseX::Types::Moose qw(ArrayRef);
  13         210763  
  13         121  
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.103005
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 ATTRIBUTES
71              
72             =head2 children
73              
74             This attribute is an arrayref of
75             L<Pod::Elemental::Node|Pod::Elemental::Node>-performing objects, and represents
76             elements contained by an object.
77              
78             =head1 AUTHOR
79              
80             Ricardo SIGNES <rjbs@cpan.org>
81              
82             =head1 COPYRIGHT AND LICENSE
83              
84             This software is copyright (c) 2020 by Ricardo SIGNES.
85              
86             This is free software; you can redistribute it and/or modify it under
87             the same terms as the Perl 5 programming language system itself.
88              
89             =cut