| 1 | #line 1 | ||||||||||||||||||||||||||||
| 2 | package Module::Install::Metadata; | ||||||||||||||||||||||||||||
| 3 | 1 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict 'vars'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | use Module::Install::Base; | ||||||||||||||||||||||||||||
| 6 | 1 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use vars qw{$VERSION $ISCORE @ISA}; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | BEGIN { | |||||||||||||||||||||||||||
| 9 | 1 | $VERSION = '0.71'; | |||||||||||||||||||||||||||
| 10 | 1 | $ISCORE = 1; | |||||||||||||||||||||||||||
| 11 | @ISA = qw{Module::Install::Base}; | ||||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||
| 13 | 1 | ||||||||||||||||||||||||||||
| 14 | my @scalar_keys = qw{ | ||||||||||||||||||||||||||||
| 15 | name | ||||||||||||||||||||||||||||
| 16 | module_name | ||||||||||||||||||||||||||||
| 17 | abstract | ||||||||||||||||||||||||||||
| 18 | author | ||||||||||||||||||||||||||||
| 19 | version | ||||||||||||||||||||||||||||
| 20 | license | ||||||||||||||||||||||||||||
| 21 | distribution_type | ||||||||||||||||||||||||||||
| 22 | perl_version | ||||||||||||||||||||||||||||
| 23 | tests | ||||||||||||||||||||||||||||
| 24 | installdirs | ||||||||||||||||||||||||||||
| 25 | }; | ||||||||||||||||||||||||||||
| 26 | 1 | ||||||||||||||||||||||||||||
| 27 | my @tuple_keys = qw{ | ||||||||||||||||||||||||||||
| 28 | configure_requires | ||||||||||||||||||||||||||||
| 29 | build_requires | ||||||||||||||||||||||||||||
| 30 | requires | ||||||||||||||||||||||||||||
| 31 | recommends | ||||||||||||||||||||||||||||
| 32 | bundles | ||||||||||||||||||||||||||||
| 33 | }; | ||||||||||||||||||||||||||||
| 34 | 6 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
Meta: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 1 | ▶ | sub Meta { shift } | ||||||||||||||||||||||||||
|
Subroutine
Meta_ScalarKeys: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub Meta_ScalarKeys { @scalar_keys } | ||||||||||||||||||||||||||
|
Subroutine
Meta_TupleKeys: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 37 | sub Meta_TupleKeys { @tuple_keys } | ||||||||||||||||||||||||||||
| 38 | 1 | ||||||||||||||||||||||||||||
| 39 | 17 | ▶ | foreach my $key (@scalar_keys) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 40 | 17 | *$key = sub { | |||||||||||||||||||||||||||
| 41 | 17 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined wantarray and not @_
MC/DC50%1/2
defined wantarray and not @_
defined wantarray
not @_
Truth table66%2/3
A and not(B)
A= defined wantarrayB= not @_
| |||||||||||||||||||||||||||||
| 42 | 9 | return $self->{values}{$key} if defined wantarray and !@_; | |||||||||||||||||||||||||||
| 43 | 9 | $self->{values}{$key} = shift; | |||||||||||||||||||||||||||
| 44 | 10 | return $self; | |||||||||||||||||||||||||||
| 45 | }; | ||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | 1 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
requires: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 48 | 1 | sub requires { | |||||||||||||||||||||||||||
| 49 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 1 | ▶ | while ( @_ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 1 | ▶ | my $module = shift or last; | ||||||||||||||||||||||||||
|
Condition50%1/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 52 | 1 | my $version = shift || 0; | |||||||||||||||||||||||||||
| 53 | push @{ $self->{values}->{requires} }, [ $module, $version ]; | ||||||||||||||||||||||||||||
| 54 | 1 | } | |||||||||||||||||||||||||||
| 55 | $self->{values}{requires}; | ||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | 7 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
build_requires: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 58 | 7 | sub build_requires { | |||||||||||||||||||||||||||
| 59 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 2 | ▶ | while ( @_ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | 2 | ▶ | my $module = shift or last; | ||||||||||||||||||||||||||
|
Condition50%1/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 62 | 2 | my $version = shift || 0; | |||||||||||||||||||||||||||
| 63 | push @{ $self->{values}->{build_requires} }, [ $module, $version ]; | ||||||||||||||||||||||||||||
| 64 | 7 | } | |||||||||||||||||||||||||||
| 65 | $self->{values}{build_requires}; | ||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
configure_requires: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 68 | 0 | sub configure_requires { | |||||||||||||||||||||||||||
| 69 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | ▶ | while ( @_ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 0 | ▶ | my $module = shift or last; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 72 | 0 | my $version = shift || 0; | |||||||||||||||||||||||||||
| 73 | push @{ $self->{values}->{configure_requires} }, [ $module, $version ]; | ||||||||||||||||||||||||||||
| 74 | 0 | } | |||||||||||||||||||||||||||
| 75 | $self->{values}{configure_requires}; | ||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
recommends: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 78 | 0 | sub recommends { | |||||||||||||||||||||||||||
| 79 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 0 | ▶ | while ( @_ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | my $module = shift or last; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 82 | 0 | my $version = shift || 0; | |||||||||||||||||||||||||||
| 83 | push @{ $self->{values}->{recommends} }, [ $module, $version ]; | ||||||||||||||||||||||||||||
| 84 | 0 | } | |||||||||||||||||||||||||||
| 85 | $self->{values}{recommends}; | ||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
bundles: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 88 | 0 | sub bundles { | |||||||||||||||||||||||||||
| 89 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 0 | ▶ | while ( @_ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | 0 | ▶ | my $module = shift or last; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 92 | 0 | my $version = shift || 0; | |||||||||||||||||||||||||||
| 93 | push @{ $self->{values}->{bundles} }, [ $module, $version ]; | ||||||||||||||||||||||||||||
| 94 | 0 | } | |||||||||||||||||||||||||||
| 95 | $self->{values}{bundles}; | ||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | # Aliases for build_requires that will have alternative | ||||||||||||||||||||||||||||
| 99 | 0 | ▶ | # meanings in some future version of META.yml. | ||||||||||||||||||||||||||
|
Subroutine
test_requires: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 100 | 0 | ▶ | sub test_requires { shift->build_requires(@_) } | ||||||||||||||||||||||||||
|
Subroutine
install_requires: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 101 | sub install_requires { shift->build_requires(@_) } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | # Aliases for installdirs options | ||||||||||||||||||||||||||
|
Subroutine
install_as_core: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 104 | 0 | ▶ | sub install_as_core { $_[0]->installdirs('perl') } | ||||||||||||||||||||||||||
|
Subroutine
install_as_cpan: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 105 | 0 | ▶ | sub install_as_cpan { $_[0]->installdirs('site') } | ||||||||||||||||||||||||||
|
Subroutine
install_as_site: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 106 | 0 | ▶ | sub install_as_site { $_[0]->installdirs('site') } | ||||||||||||||||||||||||||
|
Subroutine
install_as_vendor: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 107 | sub install_as_vendor { $_[0]->installdirs('vendor') } | ||||||||||||||||||||||||||||
| 108 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
sign: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 109 | 0 | sub sign { | |||||||||||||||||||||||||||
| 110 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined wantarray and not @_
MC/DC0%0/2
defined wantarray and not @_
defined wantarray
not @_
Truth table0%0/3
A and not(B)
A= defined wantarrayB= not @_
| |||||||||||||||||||||||||||||
| 111 | 0 | ▶ | return $self->{'values'}{'sign'} if defined wantarray and ! @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | 0 | $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); | |||||||||||||||||||||||||||
| 113 | return $self; | ||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
dynamic_config: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 116 | 0 | sub dynamic_config { | |||||||||||||||||||||||||||
| 117 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | 0 | unless ( @_ ) { | |||||||||||||||||||||||||||
| 119 | 0 | warn "You MUST provide an explicit true/false value to dynamic_config, skipping\n"; | |||||||||||||||||||||||||||
| 120 | return $self; | ||||||||||||||||||||||||||||
| 121 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | 0 | $self->{values}{dynamic_config} = $_[0] ? 1 : 0; | |||||||||||||||||||||||||||
| 123 | return $self; | ||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | 1 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
all_from: called CC=12 SCAR=33.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 126 | 1 | sub all_from { | |||||||||||||||||||||||||||
| 127 | my ( $self, $file ) = @_; | ||||||||||||||||||||||||||||
| 128 | 1 | ▶ | |||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | 0 | ▶ | unless ( defined($file) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | my $name = $self->name | ||||||||||||||||||||||||||||
| 131 | 0 | or die "all_from called with no args without setting name() first"; | |||||||||||||||||||||||||||
| 132 | 0 | ▶ | $file = join('/', 'lib', split(/-/, $name)) . '.pm'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 133 | 0 | ▶ | $file =~ s{.*/}{} unless -e $file; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | die "all_from: cannot find $file from $name" unless -e $file; | ||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | # Some methods pull from POD instead of code. | ||||||||||||||||||||||||||||
| 138 | 1 | # If there is a matching .pod, use that instead | |||||||||||||||||||||||||||
| 139 | 1 | my $pod = $file; | |||||||||||||||||||||||||||
| 140 | 1 | ▶ | $pod =~ s/\.pm$/.pod/i; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 141 | $pod = $file unless -e $pod; | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 1 | ▶ | # Pull the different values | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 1 | ▶ | $self->name_from($file) unless $self->name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 145 | 1 | ▶ | $self->version_from($file) unless $self->version; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 1 | ▶ | $self->perl_version_from($file) unless $self->perl_version; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | 1 | ▶ | $self->author_from($pod) unless $self->author; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | 1 | ▶ | $self->license_from($pod) unless $self->license; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | $self->abstract_from($pod) unless $self->abstract; | ||||||||||||||||||||||||||||
| 150 | 1 | ||||||||||||||||||||||||||||
| 151 | return 1; | ||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
provides: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 154 | 0 | sub provides { | |||||||||||||||||||||||||||
| 155 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"values"}{"provides"} ||= {}
MC/DC0%0/1
$self->{"values"}{"provides"} ||= {}
$self->{"values"}{"provides"}
Truth table0%0/2
A
A= $self->{"values"}{"provides"}
| |||||||||||||||||||||||||||||
| 156 | 0 | ▶ | my $provides = ( $self->{values}{provides} ||= {} ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 0 | %$provides = (%$provides, @_) if @_; | |||||||||||||||||||||||||||
| 158 | return $provides; | ||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
auto_provides: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 161 | 0 | sub auto_provides { | |||||||||||||||||||||||||||
| 162 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 163 | 0 | ▶ | return $self unless $self->is_admin; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 0 | unless (-e 'MANIFEST') { | |||||||||||||||||||||||||||
| 165 | 0 | warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; | |||||||||||||||||||||||||||
| 166 | return $self; | ||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | 0 | ▶ | # Avoid spurious warnings as we are not checking manifest here. | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 169 | 0 | local $SIG{__WARN__} = sub {1}; | |||||||||||||||||||||||||||
| 170 | 0 | ▶ | require ExtUtils::Manifest; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 171 | local *ExtUtils::Manifest::manicheck = sub { return }; | ||||||||||||||||||||||||||||
| 172 | 0 | ||||||||||||||||||||||||||||
| 173 | 0 | require Module::Build; | |||||||||||||||||||||||||||
| 174 | my $build = Module::Build->new( | ||||||||||||||||||||||||||||
| 175 | dist_name => $self->name, | ||||||||||||||||||||||||||||
| 176 | dist_version => $self->version, | ||||||||||||||||||||||||||||
| 177 | license => $self->license, | ||||||||||||||||||||||||||||
| 178 | 0 | ▶ | ); | ||||||||||||||||||||||||||
|
Condition0%0/2
$build->find_dist_packages || {}
MC/DC0%0/1
$build->find_dist_packages || {}
$build->find_dist_packages
Truth table0%0/2
A
A= $build->find_dist_packages
| |||||||||||||||||||||||||||||
| 179 | $self->provides( %{ $build->find_dist_packages || {} } ); | ||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
feature: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 182 | 0 | sub feature { | |||||||||||||||||||||||||||
| 183 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 184 | 0 | ▶ | my $name = shift; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"values"}{"features"} ||= []
MC/DC0%0/1
$self->{"values"}{"features"} ||= []
$self->{"values"}{"features"}
Truth table0%0/2
A
A= $self->{"values"}{"features"}
| |||||||||||||||||||||||||||||
| 185 | 0 | my $features = ( $self->{values}{features} ||= [] ); | |||||||||||||||||||||||||||
| 186 | my $mods; | ||||||||||||||||||||||||||||
| 187 | 0 | ▶ | |||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ == 1 and ref $_[0]
MC/DC0%0/2
@_ == 1 and ref $_[0]
@_ == 1
ref $_[0]
Truth table0%0/3
A and B
A= @_ == 1B= ref $_[0]
| |||||||||||||||||||||||||||||
| 188 | if ( @_ == 1 and ref( $_[0] ) ) { | ||||||||||||||||||||||||||||
| 189 | # The user used ->feature like ->features by passing in the second | ||||||||||||||||||||||||||||
| 190 | 0 | # argument as a reference. Accomodate for that. | |||||||||||||||||||||||||||
| 191 | $mods = $_[0]; | ||||||||||||||||||||||||||||
| 192 | 0 | } else { | |||||||||||||||||||||||||||
| 193 | $mods = \@_; | ||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | 0 | ||||||||||||||||||||||||||||
| 196 | my $count = 0; | ||||||||||||||||||||||||||||
| 197 | push @$features, ( | ||||||||||||||||||||||||||||
| 198 | $name => [ | ||||||||||||||||||||||||||||
| 199 | 0 | ▶ | map { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 200 | ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ | ||||||||||||||||||||||||||||
| 201 | } @$mods | ||||||||||||||||||||||||||||
| 202 | ] | ||||||||||||||||||||||||||||
| 203 | ); | ||||||||||||||||||||||||||||
| 204 | 0 | ||||||||||||||||||||||||||||
| 205 | return @$features; | ||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
features: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 208 | 0 | sub features { | |||||||||||||||||||||||||||
| 209 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 210 | 0 | while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { | |||||||||||||||||||||||||||
| 211 | $self->feature( $name, @$mods ); | ||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||
| 213 | 0 | ▶ | return $self->{values}->{features} | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | ? @{ $self->{values}->{features} } | ||||||||||||||||||||||||||||
| 215 | : (); | ||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
no_index: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 218 | 0 | sub no_index { | |||||||||||||||||||||||||||
| 219 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 220 | 0 | ▶ | my $type = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | 0 | push @{ $self->{values}{no_index}{$type} }, @_ if $type; | |||||||||||||||||||||||||||
| 222 | return $self->{values}{no_index}; | ||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
read: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 225 | 0 | sub read { | |||||||||||||||||||||||||||
| 226 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 227 | $self->include_deps( 'YAML::Tiny', 0 ); | ||||||||||||||||||||||||||||
| 228 | 0 | ||||||||||||||||||||||||||||
| 229 | 0 | require YAML::Tiny; | |||||||||||||||||||||||||||
| 230 | my $data = YAML::Tiny::LoadFile('META.yml'); | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 0 | ▶ | # Call methods explicitly in case user has already set some values. | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 233 | 0 | ▶ | while ( my ( $key, $value ) = each %$data ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 234 | 0 | ▶ | next unless $self->can($key); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | 0 | ▶ | if ( ref $value eq 'HASH' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | 0 | while ( my ( $module, $version ) = each %$value ) { | |||||||||||||||||||||||||||
| 237 | $self->can($key)->($self, $module => $version ); | ||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | 0 | } else { | |||||||||||||||||||||||||||
| 240 | $self->can($key)->($self, $value); | ||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | 0 | } | |||||||||||||||||||||||||||
| 243 | return $self; | ||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | 1 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
write: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 246 | 1 | sub write { | |||||||||||||||||||||||||||
| 247 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 248 | 1 | return $self unless $self->is_admin; | |||||||||||||||||||||||||||
| 249 | 0 | $self->admin->write_meta; | |||||||||||||||||||||||||||
| 250 | return $self; | ||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | 2 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
version_from: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 253 | 2 | sub version_from { | |||||||||||||||||||||||||||
| 254 | 2 | require ExtUtils::MM_Unix; | |||||||||||||||||||||||||||
| 255 | 2 | my ( $self, $file ) = @_; | |||||||||||||||||||||||||||
| 256 | $self->version( ExtUtils::MM_Unix->parse_version($file) ); | ||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||
| 258 | 2 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
abstract_from: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 259 | 2 | sub abstract_from { | |||||||||||||||||||||||||||
| 260 | 2 | require ExtUtils::MM_Unix; | |||||||||||||||||||||||||||
| 261 | 2 | my ( $self, $file ) = @_; | |||||||||||||||||||||||||||
| 262 | $self->abstract( | ||||||||||||||||||||||||||||
| 263 | bless( | ||||||||||||||||||||||||||||
| 264 | { DISTNAME => $self->name }, | ||||||||||||||||||||||||||||
| 265 | 'ExtUtils::MM_Unix' | ||||||||||||||||||||||||||||
| 266 | )->parse_abstract($file) | ||||||||||||||||||||||||||||
| 267 | ); | ||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||
| 269 | 0 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
name_from: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 270 | 0 | sub name_from { | |||||||||||||||||||||||||||
| 271 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 272 | if ( | ||||||||||||||||||||||||||||
| 273 | Module::Install::_read($_[0]) =~ m/ | ||||||||||||||||||||||||||||
| 274 | ^ \s | ||||||||||||||||||||||||||||
| 275 | package \s* | ||||||||||||||||||||||||||||
| 276 | ([\w:]+) | ||||||||||||||||||||||||||||
| 277 | \s* ; | ||||||||||||||||||||||||||||
| 278 | /ixms | ||||||||||||||||||||||||||||
| 279 | 0 | ) { | |||||||||||||||||||||||||||
| 280 | 0 | my $name = $1; | |||||||||||||||||||||||||||
| 281 | 0 | $name =~ s{::}{-}g; | |||||||||||||||||||||||||||
| 282 | $self->name($name); | ||||||||||||||||||||||||||||
| 283 | 0 | } else { | |||||||||||||||||||||||||||
| 284 | 0 | die "Cannot determine name from $_[0]\n"; | |||||||||||||||||||||||||||
| 285 | return; | ||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||
| 288 | 1 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
perl_version_from: called CC=2 SCAR=8.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 289 | 1 | sub perl_version_from { | |||||||||||||||||||||||||||
| 290 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 291 | if ( | ||||||||||||||||||||||||||||
| 292 | Module::Install::_read($_[0]) =~ m/ | ||||||||||||||||||||||||||||
| 293 | ^ | ||||||||||||||||||||||||||||
| 294 | use \s* | ||||||||||||||||||||||||||||
| 295 | v? | ||||||||||||||||||||||||||||
| 296 | ([\d_\.]+) | ||||||||||||||||||||||||||||
| 297 | \s* ; | ||||||||||||||||||||||||||||
| 298 | /ixms | ||||||||||||||||||||||||||||
| 299 | 0 | ) { | |||||||||||||||||||||||||||
| 300 | 0 | my $perl_version = $1; | |||||||||||||||||||||||||||
| 301 | 0 | $perl_version =~ s{_}{}g; | |||||||||||||||||||||||||||
| 302 | $self->perl_version($perl_version); | ||||||||||||||||||||||||||||
| 303 | 1 | } else { | |||||||||||||||||||||||||||
| 304 | 1 | warn "Cannot determine perl version info from $_[0]\n"; | |||||||||||||||||||||||||||
| 305 | return; | ||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | 1 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
author_from: called CC=3 SCAR=11.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 309 | 1 | sub author_from { | |||||||||||||||||||||||||||
| 310 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 311 | 1 | ▶ | my $content = Module::Install::_read($_[0]); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 312 | if ($content =~ m/ | ||||||||||||||||||||||||||||
| 313 | =head \d \s+ (?:authors?)\b \s* | ||||||||||||||||||||||||||||
| 314 | ([^\n]*) | ||||||||||||||||||||||||||||
| 315 | | | ||||||||||||||||||||||||||||
| 316 | =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* | ||||||||||||||||||||||||||||
| 317 | .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* | ||||||||||||||||||||||||||||
| 318 | ([^\n]*) | ||||||||||||||||||||||||||||
| 319 | 1 | ▶ | /ixms) { | ||||||||||||||||||||||||||
|
Condition33%1/3
$1 || $2
MC/DC0%0/2
$1 || $2
$1
$2
Truth table33%1/3
A || B
A= $1B= $2
| |||||||||||||||||||||||||||||
| 320 | 1 | my $author = $1 || $2; | |||||||||||||||||||||||||||
| 321 | 1 | $author =~ s{E<lt>}{<}g; | |||||||||||||||||||||||||||
| 322 | 1 | $author =~ s{E<gt>}{>}g; | |||||||||||||||||||||||||||
| 323 | $self->author($author); | ||||||||||||||||||||||||||||
| 324 | 0 | } else { | |||||||||||||||||||||||||||
| 325 | warn "Cannot determine author info from $_[0]\n"; | ||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | 1 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
license_from: called CC=6 SCAR=20.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 329 | 1 | sub license_from { | |||||||||||||||||||||||||||
| 330 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 331 | if ( | ||||||||||||||||||||||||||||
| 332 | Module::Install::_read($_[0]) =~ m/ | ||||||||||||||||||||||||||||
| 333 | ( | ||||||||||||||||||||||||||||
| 334 | =head \d \s+ | ||||||||||||||||||||||||||||
| 335 | (?:licen[cs]e|licensing|copyright|legal)\b | ||||||||||||||||||||||||||||
| 336 | .*? | ||||||||||||||||||||||||||||
| 337 | ) | ||||||||||||||||||||||||||||
| 338 | (=head\\d.*|=cut.*|) | ||||||||||||||||||||||||||||
| 339 | \z | ||||||||||||||||||||||||||||
| 340 | 1 | /ixms ) { | |||||||||||||||||||||||||||
| 341 | 1 | my $license_text = $1; | |||||||||||||||||||||||||||
| 342 | my @phrases = ( | ||||||||||||||||||||||||||||
| 343 | 'under the same (?:terms|license) as perl itself' => 'perl', 1, | ||||||||||||||||||||||||||||
| 344 | 'GNU public license' => 'gpl', 1, | ||||||||||||||||||||||||||||
| 345 | 'GNU lesser public license' => 'lgpl', 1, | ||||||||||||||||||||||||||||
| 346 | 'BSD license' => 'bsd', 1, | ||||||||||||||||||||||||||||
| 347 | 'Artistic license' => 'artistic', 1, | ||||||||||||||||||||||||||||
| 348 | 'GPL' => 'gpl', 1, | ||||||||||||||||||||||||||||
| 349 | 'LGPL' => 'lgpl', 1, | ||||||||||||||||||||||||||||
| 350 | 'BSD' => 'bsd', 1, | ||||||||||||||||||||||||||||
| 351 | 'Artistic' => 'artistic', 1, | ||||||||||||||||||||||||||||
| 352 | 'MIT' => 'mit', 1, | ||||||||||||||||||||||||||||
| 353 | 'proprietary' => 'proprietary', 0, | ||||||||||||||||||||||||||||
| 354 | 1 | ▶ | ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 355 | 1 | while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { | |||||||||||||||||||||||||||
| 356 | 1 | ▶ | $pattern =~ s{\s+}{\\s+}g; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 357 | 1 | ▶ | if ( $license_text =~ /\b$pattern\b/i ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$osi and $license_text =~ /All rights reserved/i
MC/DC0%0/2
$osi and $license_text =~ /All rights reserved/i
$osi
$license_text =~ /All rights reserved/i
Truth table33%1/3
A and B
A= $osiB= $license_text =~ /All rights reserved/i
| |||||||||||||||||||||||||||||
| 358 | 0 | if ( $osi and $license_text =~ /All rights reserved/i ) { | |||||||||||||||||||||||||||
| 359 | warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; | ||||||||||||||||||||||||||||
| 360 | 1 | } | |||||||||||||||||||||||||||
| 361 | 1 | $self->license($license); | |||||||||||||||||||||||||||
| 362 | return 1; | ||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||
| 366 | 0 | ||||||||||||||||||||||||||||
| 367 | 0 | warn "Cannot determine license info from $_[0]\n"; | |||||||||||||||||||||||||||
| 368 | return 'unknown'; | ||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||
| 370 | 1 | ||||||||||||||||||||||||||||
| 371 | 1; | ||||||||||||||||||||||||||||