File Coverage

blib/lib/Pod/Elemental/Element/Nested.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Pod::Elemental::Element::Nested 0.103006;
2             # ABSTRACT: an element that is a command and a node
3              
4 3     3   533 use Moose;
  3         7  
  3         19  
5             extends 'Pod::Elemental::Element::Generic::Command';
6             with 'Pod::Elemental::Node';
7             with 'Pod::Elemental::Autochomp';
8              
9 3     3   16752 use namespace::autoclean;
  3         5  
  3         28  
10              
11             # BEGIN Autochomp Replacement
12 3     3   220 use Pod::Elemental::Types qw(ChompedString);
  3         5  
  3         22  
13             has '+content' => (coerce => 1, isa => ChompedString);
14             # END Autochomp Replacement
15              
16             #pod =head1 WARNING
17             #pod
18             #pod This class is somewhat sketchy and may be refactored somewhat in the future,
19             #pod specifically to refactor its similarities to
20             #pod L<Pod::Elemental::Element::Pod5::Region>.
21             #pod
22             #pod =head1 OVERVIEW
23             #pod
24             #pod A Nested element is a Generic::Command element that is also a node.
25             #pod
26             #pod It's used by the nester transformer to produce commands with children, to make
27             #pod documents seem more structured for easy manipulation.
28             #pod
29             #pod =cut
30              
31             override as_pod_string => sub {
32             my ($self) = @_;
33              
34             my $string = super;
35              
36             $string = join q{},
37             "$string\n\n",
38             map { $_->as_pod_string } @{ $self->children };
39              
40             $string =~ s/\n{3,}\z/\n\n/g;
41              
42             return $string;
43             };
44              
45             __PACKAGE__->meta->make_immutable;
46              
47             1;
48              
49             __END__
50              
51             =pod
52              
53             =encoding UTF-8
54              
55             =head1 NAME
56              
57             Pod::Elemental::Element::Nested - an element that is a command and a node
58              
59             =head1 VERSION
60              
61             version 0.103006
62              
63             =head1 OVERVIEW
64              
65             A Nested element is a Generic::Command element that is also a node.
66              
67             It's used by the nester transformer to produce commands with children, to make
68             documents seem more structured for easy manipulation.
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 WARNING
81              
82             This class is somewhat sketchy and may be refactored somewhat in the future,
83             specifically to refactor its similarities to
84             L<Pod::Elemental::Element::Pod5::Region>.
85              
86             =head1 AUTHOR
87              
88             Ricardo SIGNES <cpan@semiotic.systems>
89              
90             =head1 COPYRIGHT AND LICENSE
91              
92             This software is copyright (c) 2022 by Ricardo SIGNES.
93              
94             This is free software; you can redistribute it and/or modify it under
95             the same terms as the Perl 5 programming language system itself.
96              
97             =cut