| 1 | package Pod::Weaver::Section::Leftovers 4.022; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: a place to put everything that nothing else used | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 9 | with 'Pod::Weaver::Role::Section', | |||||||||||||||||||||||||||
| 6 | 'Pod::Weaver::Role::Finalizer'; | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | # BEGIN BOILERPLATE | ||||||||||||||||||||||||||||
| 9 | 9 | ▶ | use v5.22.0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 9 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 9 | ▶ | no feature 'switch'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 9 | ▶ | use experimental qw(postderef postderef_qq); # This experiment gets mainlined. | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | # END BOILERPLATE | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | #pod =head1 OVERVIEW | ||||||||||||||||||||||||||||
| 17 | #pod | ||||||||||||||||||||||||||||
| 18 | #pod This section plugin is used to designate where in the output sequence all | ||||||||||||||||||||||||||||
| 19 | #pod unused parts of the input C<pod_document> should be placed. | ||||||||||||||||||||||||||||
| 20 | #pod | ||||||||||||||||||||||||||||
| 21 | #pod Other section plugins are expected to remove from the input Pod document any | ||||||||||||||||||||||||||||
| 22 | #pod sections that are consumed. At the end of all section weaving, the Leftovers | ||||||||||||||||||||||||||||
| 23 | #pod section will inject any leftover input Pod into its position in the output | ||||||||||||||||||||||||||||
| 24 | #pod document. | ||||||||||||||||||||||||||||
| 25 | #pod | ||||||||||||||||||||||||||||
| 26 | #pod =cut | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 9 | ▶ | use Pod::Elemental::Element::Pod5::Region; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | 9 | ▶ | use Pod::Elemental::Types qw(FormatName); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | has _marker => ( | ||||||||||||||||||||||||||||
| 32 | is => 'ro', | ||||||||||||||||||||||||||||
| 33 | isa => FormatName, | ||||||||||||||||||||||||||||
| 34 | init_arg => undef, | ||||||||||||||||||||||||||||
| 35 | 29 | ▶ | default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 36 | 29 | my ($self) = @_; | |||||||||||||||||||||||||||
| 37 | 29 | my $str = sprintf '%s_%s', ref($self), 0+$self; | |||||||||||||||||||||||||||
| 38 | 29 | $str =~ s/\W/_/g; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 29 | return $str; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | 9 | ); | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 29 | ▶ | sub weave_section { | ||||||||||||||||||||||||||
|
Subroutine
weave_section: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 45 | 29 | my ($self, $document, $input) = @_; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 29 | my $placeholder = Pod::Elemental::Element::Pod5::Region->new({ | |||||||||||||||||||||||||||
| 48 | is_pod => 0, | ||||||||||||||||||||||||||||
| 49 | format_name => $self->_marker, | ||||||||||||||||||||||||||||
| 50 | content => '', | ||||||||||||||||||||||||||||
| 51 | }); | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 29 | push $document->children->@*, $placeholder; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 27 | ▶ | sub finalize_document { | ||||||||||||||||||||||||||
|
Subroutine
finalize_document: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 57 | 27 | my ($self, $document, $input) = @_; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 27 | my $children = $input->{pod_document}->children; | |||||||||||||||||||||||||||
| 60 | 27 | $input->{pod_document}->children([]); | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 27 | INDEX: for my $i (0 .. $document->children->$#*) { | |||||||||||||||||||||||||||
| 63 | 104 | my $para = $document->children->[$i]; | |||||||||||||||||||||||||||
| 64 | 104 | ▶ | next unless $para->isa('Pod::Elemental::Element::Pod5::Region') | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$para->isa("Pod::Elemental::Element::Pod5::Region") and $para->format_name eq $self->_marker
MC/DC100%2/2
$para->isa("Pod::Elemental::Element::Pod5::Region") and $para->format_name eq $self->_marker
$para->isa("Pod::Elemental::Element::Pod5::Region")
$para->format_name eq $self->_marker
Truth table100%3/3
A and B
A= $para->isa("Pod::Elemental::Element::Pod5::Region")B= $para->format_name eq $self->_marker
| |||||||||||||||||||||||||||||
| 65 | and $para->format_name eq $self->_marker; | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 27 | $self->log_debug('splicing leftovers back into pod'); | |||||||||||||||||||||||||||
| 68 | 27 | splice $document->children->@*, $i, 1, @$children; | |||||||||||||||||||||||||||
| 69 | 27 | last INDEX; | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 9 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 74 | 9 | 1; | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | __END__ | ||||||||||||||||||||||||||||