| 1 | package POD::Generate; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use 5.006; use strict; use warnings; our $VERSION = q|0.01|; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 0 | ▶ | q|${}| => sub { $_[0]->generate(q|string|) }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | fallback => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=18.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | my $self = bless @_ ? @_ > 1 ? {@_} : {%{$_[0]}} : {}, ref $class || $class; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 4 | ▶ | $self->{pod} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"pod"} ||= {}
MC/DC100%1/1
$self->{"pod"} ||= {}
$self->{"pod"}
Truth table100%2/2
A
A= $self->{"pod"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | $self->{width} ||= 100; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"width"} ||= 100
MC/DC100%1/1
$self->{"width"} ||= 100
$self->{"width"}
Truth table100%2/2
A
A= $self->{"width"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 28 | ▶ | sub pod { $_[0]->{pod} } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pod: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | sub start { name(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | sub end { generate(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | sub name { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | my ($self, $name, $abbr) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | $self->pod->{$name} = __PACKAGE__->new(name => $name, width => $self->{width}, pod => []); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | ▶ | push @{ $self->pod->{$name}->pod }, { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | identifier => q|head1|, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | title => q|NAME|, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | content => $name . ($abbr ? (q| - | . $abbr) : q||) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | return $self->{pod}->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | sub generate { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 8 | ▶ | my ($self, $type) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate: called CC=8 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 8 | ▶ | if (ref $self->pod eq q|HASH|) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | my %out; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | for my $key (keys %{$self->pod}) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | $out{$key} = $self->pod->{$key}->generate(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | return \%out; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 7 | ▶ | $type ||= q|string|; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$type ||= "string"
MC/DC100%1/1
$type ||= "string"
$type
Truth table100%2/2
A
A= $type
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 7 | my $last_identifier = _last_identifier($self); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 7 | ▶ | push @{$self->{pod}}, { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | identifier => q|back| | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } if ($last_identifier =~ m/item|over/); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 7 | ▶ | push @{$self->pod}, { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | identifier => q|cut| | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } if ($last_identifier !~ m/none|cut/); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 7 | my $pod = q||; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 7 | $pod .= $self->generate_pod_section($_) for (@{ $self->pod }); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 7 | my $method = sprintf(q|to_%s|, $type); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 7 | ▶ | $self->$method($pod || q|empty|); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$pod || 'empty'
MC/DC0%0/1
$pod || 'empty'
$pod
Truth table50%1/2
A
A= $pod
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | sub add { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 40 | ▶ | my ($self, $identifier, $title, $content) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add: called CC=25 SCAR=32.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 40 | my $has_ident = defined $identifier; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 40 | ▶ | if (defined $content && ($identifier || "p") ne 'v' && $self->{width}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition87%7/8
defined $content and ($identifier || "p") ne "v" and $self->{"width"}
defined $content and ($identifier || "p") ne "v"
$identifier || 'p'
MC/DC33%1/3
defined $content and ($identifier || "p") ne "v" and $self->{"width"}
defined $content
$identifier
$self->{"width"}
Truth table50%2/4
A and B and C
A= defined $contentB= $identifierC= $self->{"width"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 26 | my @chars = split "", $content; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 26 | my $die = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 26 | my ($string, $length) = ('', 0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 26 | ▶ | while (@chars) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 540 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 540 | ▶ | $i++ while (defined $chars[$i] && $chars[$i] !~ m/(\s|\n)/); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $chars[$i] and not $chars[$i] =~ /(\s|\n)/
MC/DC100%2/2
defined $chars[$i] and not $chars[$i] =~ /(\s|\n)/
defined $chars[$i]
not $chars[$i] =~ /(\s|\n)/
Truth table100%3/3
A and not(B)
A= defined $chars[$i]B= not $chars[$i] =~ /(\s|\n)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 540 | ▶ | $length = 0 if ($i == 0 && $chars[$i] =~ m/\n/); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$i == 0 and $chars[$i] =~ /\n/
MC/DC100%2/2
$i == 0 and $chars[$i] =~ /\n/
$i == 0
$chars[$i] =~ /\n/
Truth table100%3/3
A and B
A= $i == 0B= $chars[$i] =~ /\n/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 540 | ▶ | $i ||= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$i ||= 1
MC/DC100%1/1
$i ||= 1
$i
Truth table100%2/2
A
A= $i
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | ($length + $i <= $self->{width}) ? do { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 539 | ▶ | $string .= join "", splice @chars, 0, $i || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$i || 1
MC/DC0%0/1
$i || 1
$i
Truth table50%1/2
A
A= $i
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 539 | $length += $i; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 540 | ▶ | } : do { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 1 | ▶ | $string .= "\n" . join "", splice @chars, 0, $i || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$i || 1
MC/DC0%0/1
$i || 1
$i
Truth table50%1/2
A
A= $i
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | ▶ | $string =~ s/\s$//i && $i--; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | $length = $i; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 26 | $content = $string; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | ▶ | } elsif ($has_ident && $identifier eq 'v') { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$has_ident and $identifier eq "v"
MC/DC50%1/2
$has_ident and $identifier eq "v"
$has_ident
$identifier eq "v"
Truth table66%2/3
A and B
A= $has_identB= $identifier eq "v"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 5 | $identifier = $has_ident = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 40 | ▶ | if ($has_ident) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 33 | ▶ | if ($identifier eq q|item|) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 12 | ▶ | if (_last_identifier($self) !~ m/item|over/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 4 | push @{$self->{pod}}, { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | identifier => q|over| | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 21 | my $last_identifier = _last_identifier($self); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 21 | ▶ | if ($last_identifier =~ m/item|over/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 4 | push @{$self->{pod}}, { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | identifier => q|back| | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 21 | ▶ | push @{$self->{pod}}, { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | identifier => q|cut| | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } if ($last_identifier !~ m/cut/); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 40 | ▶ | push @{ $self->{pod} }, { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | (defined $identifier ? (identifier => $identifier) : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | (defined $title ? (title => $title) : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | (defined $content ? (content => $content) : ()) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | sub p { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
p: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 2 | $self->add(undef, undef, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 2 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | sub v { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
v: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 3 | $self->add('v', undef, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 3 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | sub h1 { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
h1: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $self->add(q|head1|, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | sub h2 { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
h2: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 3 | $self->add(q|head2|, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 3 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | sub h3 { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
h3: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 1 | $self->add(q|head3|, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | sub h4 { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
h4: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 1 | $self->add(q|head4|, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | sub item { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
item: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 6 | $self->add(q|item|, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 6 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | sub version { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $self->add(q|head1|, q|VERSION|, $self->_default_version_cb(@_)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | sub description { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 2 | $self->add(q|head1|, q|DESCRIPTION|, $self->_default_description_cb(@_)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 2 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | sub synopsis { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
synopsis: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 2 | $self->add(q|head1|, q|SYNOPSIS|, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 2 | $self->add(q|v|, undef, $self->_default_synopsis_cb(@_)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 2 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | sub methods { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
methods: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 2 | $self->add(q|head1|, q|METHODS|, $self->_default_methods_cb(@_)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 2 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | sub exports { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exports: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $self->add(q|head1|, q|EXPORTS|, $self->_default_exports_cb(@_)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | sub footer { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | ▶ | my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
footer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | $self->formatted_author($args{name}, $args{email}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | ->bugs($args{bugs}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | ->support($args{support}, @{$args{support_items}}) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | ->acknowledgements($args{acknowledgements}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | ->license($args{license}, $args{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 1 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | sub author { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
author: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | $self->add(q|head1|, q|AUTHOR|, $self->_default_author_cb(@_)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | sub formatted_author { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 1 | ▶ | my ($self, $name, $email) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
formatted_author: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | $email =~ s/\@/ at /g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 1 | $self->add(q|head1|, q|AUTHOR|, sprintf(q|%s, C<< <%s> >>|, $name, $email)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | $self | |||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | sub bugs { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 2 | ▶ | my ($self, $content) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bugs: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 2 | $self->add(q|head1|, q|BUGS|, $self->_default_bugs_cb($content)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 2 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | sub support { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 2 | ▶ | my ($self, $content, @items) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
support: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 2 | $self->add(q|head1|, q|SUPPORT|, $self->_default_support_cb($content)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 2 | @items = $self->_default_support_items_cb(@items); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 2 | $self->add(q|item|, @{$_}) for (@items); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 2 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | sub _default_version_cb { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_version_cb: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | return $self->{version_cb} && $self->{version_cb}->($self, @_) || @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$self->{'version_cb'} && $self->{'version_cb'}->($self, @_) || @_
$self->{"version_cb"} and $self->{"version_cb"}->($self, @_)
MC/DC0%0/3
$self->{'version_cb'} && $self->{'version_cb'}->($self, @_) || @_
$self->{"version_cb"}
$self->{"version_cb"}->($self, @_)
@_
Truth table0%0/5
A and B || C
A= $self->{"version_cb"}B= $self->{"version_cb"}->($self, @_)C= @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | sub _default_description_cb { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 2 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_description_cb: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 2 | ▶ | return $self->{description_cb} && $self->{description_cb}->($self, @_) || @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$self->{'description_cb'} && $self->{'description_cb'}->($self, @_) || @_
$self->{"description_cb"} and $self->{"description_cb"}->($self, @_)
MC/DC0%0/3
$self->{'description_cb'} && $self->{'description_cb'}->($self, @_) || @_
$self->{"description_cb"}
$self->{"description_cb"}->($self, @_)
@_
Truth table20%1/5
A and B || C
A= $self->{"description_cb"}B= $self->{"description_cb"}->($self, @_)C= @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | sub _default_synopsis_cb { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 2 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_synopsis_cb: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 2 | ▶ | return $self->{synopsis_cb} && $self->{synopsis_cb}->($self, @_) || @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$self->{'synopsis_cb'} && $self->{'synopsis_cb'}->($self, @_) || @_
$self->{"synopsis_cb"} and $self->{"synopsis_cb"}->($self, @_)
MC/DC0%0/3
$self->{'synopsis_cb'} && $self->{'synopsis_cb'}->($self, @_) || @_
$self->{"synopsis_cb"}
$self->{"synopsis_cb"}->($self, @_)
@_
Truth table20%1/5
A and B || C
A= $self->{"synopsis_cb"}B= $self->{"synopsis_cb"}->($self, @_)C= @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | sub _default_methods_cb { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 2 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_methods_cb: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 2 | ▶ | return $self->{methods_cb} && $self->{methods_cb}->($self, @_) || @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$self->{'methods_cb'} && $self->{'methods_cb'}->($self, @_) || @_
$self->{"methods_cb"} and $self->{"methods_cb"}->($self, @_)
MC/DC0%0/3
$self->{'methods_cb'} && $self->{'methods_cb'}->($self, @_) || @_
$self->{"methods_cb"}
$self->{"methods_cb"}->($self, @_)
@_
Truth table20%1/5
A and B || C
A= $self->{"methods_cb"}B= $self->{"methods_cb"}->($self, @_)C= @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | sub _default_exports_cb { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_exports_cb: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | return $self->{exports_cb} && $self->{exports_cb}->($self, @_) || @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$self->{'exports_cb'} && $self->{'exports_cb'}->($self, @_) || @_
$self->{"exports_cb"} and $self->{"exports_cb"}->($self, @_)
MC/DC0%0/3
$self->{'exports_cb'} && $self->{'exports_cb'}->($self, @_) || @_
$self->{"exports_cb"}
$self->{"exports_cb"}->($self, @_)
@_
Truth table0%0/5
A and B || C
A= $self->{"exports_cb"}B= $self->{"exports_cb"}->($self, @_)C= @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | sub _default_author_cb { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 1 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_author_cb: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 1 | ▶ | return $self->{author_cb} && $self->{author_cb}->($self, @_) || @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$self->{'author_cb'} && $self->{'author_cb'}->($self, @_) || @_
$self->{"author_cb"} and $self->{"author_cb"}->($self, @_)
MC/DC0%0/3
$self->{'author_cb'} && $self->{'author_cb'}->($self, @_) || @_
$self->{"author_cb"}
$self->{"author_cb"}->($self, @_)
@_
Truth table20%1/5
A and B || C
A= $self->{"author_cb"}B= $self->{"author_cb"}->($self, @_)C= @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | sub _default_bugs_cb { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 2 | ▶ | my ($self, $content) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_bugs_cb: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | return $self->{bugs_cb} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 2 | ▶ | ? $self->{bugs_cb}->($self, $content) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | : defined $content | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | ? $content | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | : $self->_default_bugs_content(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | sub _default_bugs_content { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_bugs_content: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 2 | (my $formatted_name = $self->{name}) =~ s/\:\:/\-/g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 2 | my $content = sprintf( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | qq|Please report any bugs or feature requests to C<bug-%s at rt.cpan.org>, or through\n|, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | lc($formatted_name) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 2 | $content .= sprintf( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | qq|the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=%s>. I will\n|, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | $formatted_name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 2 | $content .= q|be notified, and then you'll automatically be notified of progress on your bug as I make changes.|; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 2 | return $content; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | sub _default_support_cb { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 2 | ▶ | my ($self, $content) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_support_cb: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | return $self->{support_cb} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 2 | ▶ | ? $self->{support_cb}->($self, $content) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | : defined $content | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | ? $content | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | : $self->_default_support_content(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | sub _default_support_content { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_support_content: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 2 | my $content = q|You can find documentation for this module with the perldoc command.|; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 2 | $content .= sprintf(qq|\n\n perldoc %s\n\n|, $self->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 2 | $content .= q|You can also look for information at:|; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 2 | return $content; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | sub _default_support_items_cb { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 2 | ▶ | my ($self, @items) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_support_items_cb: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | return $self->{support_items_cb} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 2 | ▶ | ? $self->{support_items_cb}->($self, @items) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | : scalar @items | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | ? @items | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | : $self->_default_support_items(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | sub _default_support_items { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_support_items: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 2 | my @items = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 2 | (my $formatted_name = $self->{name}) =~ s/\:\:/\-/g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 2 | push @items, [ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | q|* RT: CPAN's request tracker (report bugs here)|, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | sprintf(q|L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=%s>|, $formatted_name) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 2 | push @items, [ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | q|* CPAN Ratings|, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | sprintf(q|L<https://cpanratings.perl.org/d/%s>|, $formatted_name) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 2 | push @items, [ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | q|* Search CPAN|, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | sprintf(q|L<https://metacpan.org/release/%s>|, $formatted_name) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 2 | return @items; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | sub acknowledgements { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
acknowledgements: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 2 | $self->add(q|head1|, q|ACKNOWLEDGEMENTS|, $self->default_acknowledgements_cb(@_)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 2 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | sub default_acknowledgements_cb { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 2 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_acknowledgements_cb: called CC=3 SCAR=12.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 2 | ▶ | return $self->{acknowledgements_cb} && $self->{acknowledgements_cb}->($self, @_) || @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$self->{'acknowledgements_cb'} && $self->{'acknowledgements_cb'}->($self, @_) || @_
$self->{"acknowledgements_cb"} and $self->{"acknowledgements_cb"}->($self, @_)
MC/DC33%1/3
$self->{'acknowledgements_cb'} && $self->{'acknowledgements_cb'}->($self, @_) || @_
$self->{"acknowledgements_cb"}
$self->{"acknowledgements_cb"}->($self, @_)
@_
Truth table40%2/5
A and B || C
A= $self->{"acknowledgements_cb"}B= $self->{"acknowledgements_cb"}->($self, @_)C= @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | sub license { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 2 | ▶ | my ($self, $license, $name) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
license: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 2 | $self->add(q|head1|, q|LICENSE AND COPYRIGHT|, $self->default_license_cb($license, $name)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | sub default_license_cb { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 2 | ▶ | my ($self, $license, $name) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_license_cb: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | return $self->{license_cb} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 2 | ▶ | ? $self->{license_cb}->($self, $license, $name) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | : defined $license | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | ? $license | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | : $self->default_license_content($name); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | sub default_license_content { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 2 | ▶ | my ($self, $author) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_license_content: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 2 | ▶ | my $content = sprintf(qq|This software is Copyright (c) 2022 %s\n\n|, $author || q|by the author|); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$author || 'by the author'
MC/DC100%1/1
$author || 'by the author'
$author
Truth table100%2/2
A
A= $author
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 2 | $content .= q|This is free software, licensed under:|; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 2 | $content .= qq|\n\n The Artistic License 2.0 (GPL Compatible)|; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | sub generate_pod_section { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 169 | ▶ | my ($self, $section) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_pod_section: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 169 | my $pod = q||; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 169 | ▶ | $pod .= sprintf(qq|\n\n=%s|, $section->{identifier}) if $section->{identifier}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 169 | ▶ | $pod .= sprintf(q| %s|, $section->{title}) if $section->{title}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 169 | ▶ | $pod .= sprintf(qq|\n\n%s|, $section->{content}) if $section->{content}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 169 | return $pod; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | sub to_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 5 | ▶ | my ($self, $string) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_string: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 5 | ▶ | return $_[0]->generate(q|string|) if (!$string); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 5 | $string =~ s/^\n*//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 5 | return $string; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | sub to_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 1 | ▶ | my ($self, $string) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_file: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 1 | ▶ | return $_[0]->generate(q|file|) if (!$string); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 1 | (my $file = $self->{name}) =~ s/\:\:/\//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 1 | $file .= '.pm'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 1 | require $file; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 1 | $file = $INC{$file}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 1 | ▶ | open my $fh, "<", $file or die "Cannot open file for read/writing $file"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 1 | my $current = do { local $/; <$fh> }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 1 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 1 | ▶ | die "no \_\_END\_\_ to code bailing on writing to the .pm file" unless $current =~ s/(\_\_END\_\_).*/$1/xmsg; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 1 | $current .= $string; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 1 | open my $wh, ">", $file; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 1 | print $wh $current; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 1 | close $wh; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 1 | return $string; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | sub to_seperate_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 1 | ▶ | my ($self, $string) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_seperate_file: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 1 | ▶ | return $_[0]->generate(q|seperate_file|) if (!$string); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 1 | (my $file = $self->{name}) =~ s/\:\:/\//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 1 | $file .= '.pm'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 1 | require $file; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 1 | $file = $INC{$file}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 1 | $file =~ s/pm$/pod/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 1 | $string =~ s/^\n*//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 1 | open my $wh, ">", $file; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 1 | print $wh $string; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 1 | close $wh; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 1 | return $string; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | sub _last_identifier { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 40 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_last_identifier: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 40 | my ($i, $last_identifier) = -1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | $self->{pod}->[$i] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | ? $self->{pod}->[$i]->{identifier} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 40 | ? do { $last_identifier = $self->{pod}->[$i]->{identifier}; 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | : $i-- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 40 | ▶ | : do { $last_identifier = q|none|; } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | while (!$last_identifier); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 40 | return $last_identifier; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||