example/inc/Module/Install/Metadata.pm

filter: Statementstmt 40.9% 104 / 254 Branchbran 27.6% 37 / 134 Conditioncond 19.5% 8 / 41 MC/DCmcdc 4.1% 1 / 24 Subroutinesub 43.1% 19 / 44 Podpod 0.0% 0 / 36 totaltotal 31.7% 169 / 533 CC 86 SCAR 28.0
CC
86
Cov
35%
feature
42.0
license_from
42.0
install_script
42.0
CRAP 16.5
« example/inc/Module/Install.pm ↑ Summary example/inc/Module/Install/Makefile.pm »
1 #line 1
2 #line 1
3 1 ▶package Module::Install::Metadata;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
5 use strict 'vars';
6 1 ▶use Module::Install::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 use vars qw{$VERSION $ISCORE @ISA};
9 1 BEGIN {
10 1 $VERSION = '0.77';
11 $ISCORE = 1;
12 @ISA = qw{Module::Install::Base};
13 1 }
14  
15 my @scalar_keys = qw{
16 name
17 module_name
18 abstract
19 author
20 version
21 distribution_type
22 tests
23 installdirs
24 1 };
25  
26 my @tuple_keys = qw{
27 configure_requires
28 build_requires
29 requires
30 recommends
31 bundles
32 resources
33 1 };
34  
35 my @resource_keys = qw{
36 homepage
37 bugtracker
38 repository
39 1 ▶};
Subroutine Meta: called CC=1 SCAR=0.0
Pod undocumented
40 0 ▶ 
Subroutine Meta_ScalarKeys: not called CC=1 SCAR=6.9
Pod undocumented
41 0 ▶sub Meta { shift }
Subroutine Meta_TupleKeys: not called CC=1 SCAR=6.9
Pod undocumented
42 0 ▶sub Meta_ScalarKeys { @scalar_keys }
Subroutine Meta_ResourceKeys: not called CC=1 SCAR=6.9
Pod undocumented
43 sub Meta_TupleKeys { @tuple_keys }
44 1 sub Meta_ResourceKeys { @resource_keys }
45 19 ▶ 
Subroutine __ANON__: called CC=3 SCAR=11.0
46 19 foreach my $key ( @scalar_keys ) {
47 19 ▶ *$key = sub {
Branch: 1 branch
BranchTrueFalseTotal
if defined wantarray and not @_ 14 5 19
Condition66%2/3
defined wantarray and not @_
!ll&&!rl&&r
5014
MC/DC50%1/2
defined wantarray and not @_
defined wantarray not @_
Truth table66%2/3
A and not(B)
A= defined wantarrayB= not @_
ABresult
0X0
100
111
48 5 my $self = shift;
49 5 return $self->{values}{$key} if defined wantarray and !@_;
50 8 $self->{values}{$key} = shift;
51 return $self;
52 };
53 1 }
54 0 ▶ 
Subroutine __ANON__: not called CC=5 SCAR=34.0
55 0 foreach my $key ( @resource_keys ) {
56 0 ▶ *$key = sub {
Branch: 1 branch
BranchTrueFalseTotal
unless (@_) 0 0 0
57 0 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"values"}{"resources"} 0 0 0
58 0 unless ( @_ ) {
59 0 return () unless $self->{values}{resources};
60 0 return map { $_->[1] }
61 grep { $_->[0] eq $key }
62 0 ▶ @{ $self->{values}{resources} };
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
63 0 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
my $uri = shift() or die "Did not provide a value to $key()" 0 0 0
64 return $self->{values}{resources}{$key} unless @_;
65 my $uri = shift or die(
66 0 "Did not provide a value to $key()"
67 0 );
68 3 $self->resources( $key => $uri );
69 return 1;
70 };
71 2 ▶}
Subroutine requires: called CC=4 SCAR=14.0
Pod undocumented
72 2  
73 2 ▶sub requires {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 2 3
74 1 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
my $module = shift() or last 1 0 1
75 1 ▶ while ( @_ ) {
Condition50%1/2
shift() || 0
l!l
01
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
76 1 my $module = shift or last;
77 my $version = shift || 0;
78 2 push @{ $self->{values}{requires} }, [ $module, $version ];
79 }
80 $self->{values}{requires};
81 2 ▶}
Subroutine build_requires: called CC=4 SCAR=14.0
Pod undocumented
82 2  
83 2 ▶sub build_requires {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 2 3
84 1 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
my $module = shift() or last 1 0 1
85 1 ▶ while ( @_ ) {
Condition50%1/2
shift() || 0
l!l
10
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
86 1 my $module = shift or last;
87 my $version = shift || 0;
88 2 push @{ $self->{values}{build_requires} }, [ $module, $version ];
89 }
90 $self->{values}{build_requires};
91 2 ▶}
Subroutine configure_requires: called CC=4 SCAR=14.0
Pod undocumented
92 2  
93 2 ▶sub configure_requires {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 2 3
94 1 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
my $module = shift() or last 1 0 1
95 1 ▶ while ( @_ ) {
Condition50%1/2
shift() || 0
l!l
10
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
96 1 my $module = shift or last;
97 my $version = shift || 0;
98 2 push @{ $self->{values}{configure_requires} }, [ $module, $version ];
99 }
100 $self->{values}{configure_requires};
101 0 ▶}
Subroutine recommends: not called CC=4 SCAR=30.0
Pod undocumented
102 0  
103 0 ▶sub recommends {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
104 0 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
my $module = shift() or last 0 0 0
105 0 ▶ while ( @_ ) {
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
106 0 my $module = shift or last;
107 my $version = shift || 0;
108 0 push @{ $self->{values}{recommends} }, [ $module, $version ];
109 }
110 $self->{values}{recommends};
111 1 ▶}
Subroutine bundles: called CC=4 SCAR=22.3
Pod undocumented
112 1  
113 1 ▶sub bundles {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 1 1
114 0 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
my $module = shift() or last 0 0 0
115 0 ▶ while ( @_ ) {
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
116 0 my $module = shift or last;
117 my $version = shift || 0;
118 1 push @{ $self->{values}{bundles} }, [ $module, $version ];
119 }
120 $self->{values}{bundles};
121 }
122 1  
123 # Resource handling
124 my %lc_resource = map { $_ => 1 } qw{
125 homepage
126 license
127 bugtracker
128 repository
129 1 ▶};
Subroutine resources: called CC=7 SCAR=21.3
Pod undocumented
130 1  
131 1 ▶sub resources {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 1 2
132 1 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
my $name = shift() or last 1 0 1
133 1 ▶ while ( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
my $value = shift() or next 1 0 1
134 1 ▶ my $name = shift or last;
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq lc $name and not $lc_resource{$name}) 0 1 1
Condition33%1/3
$name eq lc $name and not $lc_resource{$name}
!ll&&!rl&&r
010
MC/DC0%0/2
$name eq lc $name and not $lc_resource{$name}
$name eq lc $name not $lc_resource{$name}
Truth table33%1/3
A and not(B)
A= $name eq lc $nameB= not $lc_resource{$name}
ABresult
0X0
100
111
135 0 my $value = shift or next;
136 if ( $name eq lc $name and ! $lc_resource{$name} ) {
137 1 ▶ die("Unsupported reserved lowercase resource '$name'");
Condition50%1/2
$self->{"values"}{"resources"} ||= []
l!l
01
MC/DC0%0/1
$self->{"values"}{"resources"} ||= []
$self->{"values"}{"resources"}
Truth table50%1/2
A
A= $self->{"values"}{"resources"}
Aresult
11
00
138 1 }
139 $self->{values}{resources} ||= [];
140 1 push @{ $self->{values}{resources} }, [ $name, $value ];
141 }
142 $self->{values}{resources};
143 }
144  
145 0 ▶# Aliases for build_requires that will have alternative
Subroutine test_requires: not called CC=1 SCAR=6.9
Pod undocumented
146 0 ▶# meanings in some future version of META.yml.
Subroutine install_requires: not called CC=1 SCAR=6.9
Pod undocumented
147 sub test_requires { shift->build_requires(@_) }
148 sub install_requires { shift->build_requires(@_) }
149 0 ▶ 
Subroutine install_as_core: not called CC=1 SCAR=6.9
Pod undocumented
150 0 ▶# Aliases for installdirs options
Subroutine install_as_cpan: not called CC=1 SCAR=6.9
Pod undocumented
151 0 ▶sub install_as_core { $_[0]->installdirs('perl') }
Subroutine install_as_site: not called CC=1 SCAR=6.9
Pod undocumented
152 0 ▶sub install_as_cpan { $_[0]->installdirs('site') }
Subroutine install_as_vendor: not called CC=1 SCAR=6.9
Pod undocumented
153 sub install_as_site { $_[0]->installdirs('site') }
154 1 ▶sub install_as_vendor { $_[0]->installdirs('vendor') }
Subroutine sign: called CC=4 SCAR=20.9
Pod undocumented
155 1  
156 1 ▶sub sign {
Branch: 1 branch
BranchTrueFalseTotal
if defined wantarray and not @_ 1 0 1
Condition33%1/3
defined wantarray and not @_
!ll&&!rl&&r
001
MC/DC0%0/2
defined wantarray and not @_
defined wantarray not @_
Truth table33%1/3
A and not(B)
A= defined wantarrayB= not @_
ABresult
0X0
100
111
157 0 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
158 0 return $self->{values}{sign} if defined wantarray and ! @_;
159 $self->{values}{sign} = ( @_ ? $_[0] : 1 );
160 return $self;
161 0 ▶}
Subroutine dynamic_config: not called CC=3 SCAR=24.8
Pod undocumented
162 0  
163 0 ▶sub dynamic_config {
Branch: 1 branch
BranchTrueFalseTotal
unless (@_) 0 0 0
164 0 my $self = shift;
165 0 unless ( @_ ) {
166 warn "You MUST provide an explicit true/false value to dynamic_config\n";
167 0 ▶ return $self;
Branch: 1 branch
BranchTrueFalseTotal
$_[0] ? : 0 0 0
168 0 }
169 $self->{values}{dynamic_config} = $_[0] ? 1 : 0;
170 return 1;
171 3 ▶}
Subroutine perl_version: called CC=4 SCAR=14.4
Pod undocumented
172 3  
173 3 ▶sub perl_version {
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 2 1 3
174 1 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
my $version = shift() or die "Did not provide a value to perl_version()" 1 0 1
175 return $self->{values}{perl_version} unless @_;
176 my $version = shift or die(
177 "Did not provide a value to perl_version()"
178 );
179  
180 # Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
181 0 # numbers (eg, 5.006001 or 5.008009).
182  
183 1 $version =~ s/^(\d+)\.(\d+)\.(\d+)$/sprintf("%d.%03d%03d",$1,$2,$3)/e;
184 1  
185 1 ▶ $version =~ s/_.+$//;
Branch: 1 branch
BranchTrueFalseTotal
unless ($version >= "5.005") 0 1 1
186 0 $version = $version + 0; # Numify
187 unless ( $version >= 5.005 ) {
188 1 die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
189 1 }
190 $self->{values}{perl_version} = $version;
191 return 1;
192 2 ▶}
Subroutine license: called CC=4 SCAR=14.0
Pod undocumented
193 2  
194 2 ▶sub license {
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 1 1 2
195 1 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
my $license = shift() or die "Did not provide a value to license()" 1 0 1
196 return $self->{values}{license} unless @_;
197 my $license = shift or die(
198 1 'Did not provide a value to license()'
199 );
200 $self->{values}{license} = $license;
201 1 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if ($license eq "perl") 1 0 1
202 1 # Automatically fill in license URLs
203 if ( $license eq 'perl' ) {
204 $self->resources( license => 'http://dev.perl.org/licenses/' );
205 1 }
206  
207 return 1;
208 1 ▶}
Subroutine all_from: called CC=13 SCAR=34.9
Pod undocumented
209 1  
210 sub all_from {
211 1 ▶ my ( $self, $file ) = @_;
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $file) 0 1 1
212 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
my $name = $self->name or die "all_from called with no args without setting name() first" 0 0 0
213 unless ( defined($file) ) {
214 my $name = $self->name or die(
215 0 "all_from called with no args without setting name() first"
216 0 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
unless -e $file 0 0 0
217 0 ▶ $file = join('/', 'lib', split(/-/, $name)) . '.pm';
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $file) 0 0 0
218 0 $file =~ s{.*/}{} unless -e $file;
219 unless ( -e $file ) {
220 die("all_from cannot find $file from $name");
221 1 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
unless (-f $file) 0 1 1
222 0 }
223 unless ( -f $file ) {
224 die("The path '$file' does not exist, or is not a file");
225 }
226  
227 1 # Some methods pull from POD instead of code.
228 1 # If there is a matching .pod, use that instead
229 1 ▶ my $pod = $file;
Branch: 1 branch
BranchTrueFalseTotal
unless -e $pod 1 0 1
230 $pod =~ s/\.pm$/.pod/i;
231 $pod = $file unless -e $pod;
232 1 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
unless $self->name 0 1 1
233 1 ▶ # Pull the different values
Branch: 1 branch
BranchTrueFalseTotal
unless $self->version 1 0 1
234 1 ▶ $self->name_from($file) unless $self->name;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->perl_version 1 0 1
235 1 ▶ $self->version_from($file) unless $self->version;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->author 0 1 1
236 1 ▶ $self->perl_version_from($file) unless $self->perl_version;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->license 0 1 1
237 1 ▶ $self->author_from($pod) unless $self->author;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->abstract 1 0 1
238 $self->license_from($pod) unless $self->license;
239 1 $self->abstract_from($pod) unless $self->abstract;
240  
241 return 1;
242 0 ▶}
Subroutine provides: not called CC=3 SCAR=24.8
Pod undocumented
243 0  
244 0 ▶sub provides {
Condition0%0/2
$self->{"values"}{"provides"} ||= {}
l!l
00
MC/DC0%0/1
$self->{"values"}{"provides"} ||= {}
$self->{"values"}{"provides"}
Truth table0%0/2
A
A= $self->{"values"}{"provides"}
Aresult
11
00
245 0 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
246 0 my $provides = ( $self->{values}{provides} ||= {} );
247 %$provides = (%$provides, @_) if @_;
248 return $provides;
249 0 ▶}
Subroutine auto_provides: not called CC=4 SCAR=30.0
Pod undocumented
250 0  
251 0 ▶sub auto_provides {
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_admin 0 0 0
252 0 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
unless (-e "MANIFEST") 0 0 0
253 0 return $self unless $self->is_admin;
254 0 unless (-e 'MANIFEST') {
255 warn "Cannot deduce auto_provides without a MANIFEST, skipping\n";
256 return $self;
257 0 ▶ }
Subroutine __ANON__: not called CC=1 SCAR=6.9
258 0 # Avoid spurious warnings as we are not checking manifest here.
259 0 ▶ local $SIG{__WARN__} = sub {1};
Subroutine __ANON__: not called CC=1 SCAR=6.9
260 require ExtUtils::Manifest;
261 0 local *ExtUtils::Manifest::manicheck = sub { return };
262 0  
263 require Module::Build;
264 my $build = Module::Build->new(
265 dist_name => $self->name,
266 dist_version => $self->version,
267 0 ▶ license => $self->license,
Condition0%0/2
$build->find_dist_packages || {}
l!l
00
MC/DC0%0/1
$build->find_dist_packages || {}
$build->find_dist_packages
Truth table0%0/2
A
A= $build->find_dist_packages
Aresult
11
00
268 );
269 $self->provides( %{ $build->find_dist_packages || {} } );
270 0 ▶}
Subroutine feature: not called CC=6 SCAR=37.4
Pod undocumented
271 0  
272 0 sub feature {
273 0 ▶ my $self = shift;
Condition0%0/2
$self->{"values"}{"features"} ||= []
l!l
00
MC/DC0%0/1
$self->{"values"}{"features"} ||= []
$self->{"values"}{"features"}
Truth table0%0/2
A
A= $self->{"values"}{"features"}
Aresult
11
00
274 0 my $name = shift;
275 my $features = ( $self->{values}{features} ||= [] );
276 0 ▶ my $mods;
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0]) { } 0 0 0
Condition0%0/3
@_ == 1 and ref $_[0]
!ll&&!rl&&r
000
MC/DC0%0/2
@_ == 1 and ref $_[0]
@_ == 1 ref $_[0]
Truth table0%0/3
A and B
A= @_ == 1B= ref $_[0]
ABresult
0X0
100
111
277  
278 if ( @_ == 1 and ref( $_[0] ) ) {
279 0 # The user used ->feature like ->features by passing in the second
280 # argument as a reference. Accomodate for that.
281 0 $mods = $_[0];
282 } else {
283 $mods = \@_;
284 0 }
285  
286 my $count = 0;
287 push @$features, (
288 0 ▶ $name => [
Branch: 2 branches
BranchTrueFalseTotal
ref $_ ? : 0 0 0
ref $_ eq 'HASH' ? : 0 0 0
289 map {
290 ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_
291 } @$mods
292 ]
293 0 );
294  
295 return @$features;
296 0 ▶}
Subroutine features: not called CC=3 SCAR=24.8
Pod undocumented
297 0  
298 0 ▶sub features {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@_, 0, 2)) 0 0 0
299 0 my $self = shift;
300 while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) {
301 $self->feature( $name, @$mods );
302 0 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
$self->{'values'}{'features'} ? : 0 0 0
303 return $self->{values}{features}
304 ? @{ $self->{values}{features} }
305 : ();
306 0 ▶}
Subroutine no_index: not called CC=2 SCAR=17.9
Pod undocumented
307 0  
308 0 sub no_index {
309 0 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
if $type 0 0 0
310 0 my $type = shift;
311 push @{ $self->{values}{no_index}{$type} }, @_ if $type;
312 return $self->{values}{no_index};
313 0 ▶}
Subroutine read: not called CC=5 SCAR=34.0
Pod undocumented
314 0  
315 0 sub read {
316 my $self = shift;
317 0 $self->include_deps( 'YAML::Tiny', 0 );
318 0  
319 require YAML::Tiny;
320 my $data = YAML::Tiny::LoadFile('META.yml');
321 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$data) 0 0 0
322 0 ▶ # Call methods explicitly in case user has already set some values.
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can($key) 0 0 0
323 0 ▶ while ( my ( $key, $value ) = each %$data ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $value eq 'HASH') { } 0 0 0
324 0 ▶ next unless $self->can($key);
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$value) 0 0 0
325 0 if ( ref $value eq 'HASH' ) {
326 while ( my ( $module, $version ) = each %$value ) {
327 $self->can($key)->($self, $module => $version );
328 0 }
329 } else {
330 $self->can($key)->($self, $value);
331 0 }
332 }
333 return $self;
334 1 ▶}
Subroutine write: called CC=2 SCAR=9.2
Pod undocumented
335 1  
336 1 ▶sub write {
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_admin 1 0 1
337 0 my $self = shift;
338 0 return $self unless $self->is_admin;
339 $self->admin->write_meta;
340 return $self;
341 1 ▶}
Subroutine version_from: called CC=1 SCAR=0.0
Pod undocumented
342 1  
343 1 sub version_from {
344 1 require ExtUtils::MM_Unix;
345 my ( $self, $file ) = @_;
346 $self->version( ExtUtils::MM_Unix->parse_version($file) );
347 1 ▶}
Subroutine abstract_from: called CC=1 SCAR=0.0
Pod undocumented
348 1  
349 1 sub abstract_from {
350 1 require ExtUtils::MM_Unix;
351 my ( $self, $file ) = @_;
352 $self->abstract(
353 bless(
354 { DISTNAME => $self->name },
355 'ExtUtils::MM_Unix'
356 )->parse_abstract($file)
357 );
358 }
359 0 ▶ 
Subroutine name_from: not called CC=3 SCAR=24.8
Pod undocumented
360 0 # Add both distribution and module name
361 0 ▶sub name_from {
Branch: 1 branch
BranchTrueFalseTotal
if (Module::Install::_read($file) =~ / ^ \s* package \s* ([\w:]+) \s* ; /imsx) { } 0 0 0
362 my ($self, $file) = @_;
363 if (
364 Module::Install::_read($file) =~ m/
365 ^ \s*
366 package \s*
367 ([\w:]+)
368 \s* ;
369 0 /ixms
370 0 ) {
371 0 my ($name, $module_name) = ($1, $1);
372 0 ▶ $name =~ s{::}{-}g;
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->module_name) 0 0 0
373 0 $self->name($name);
374 unless ( $self->module_name ) {
375 $self->module_name($module_name);
376 0 }
377 } else {
378 die("Cannot determine name from $file\n");
379 }
380 1 ▶}
Subroutine perl_version_from: called CC=2 SCAR=7.6
Pod undocumented
381 1  
382 1 ▶sub perl_version_from {
Branch: 1 branch
BranchTrueFalseTotal
if (Module::Install::_read($_[0]) =~ / ^ (?:use|require) \s* v? ([\d_\.]+) \s* ; /imsx) { } 1 0 1
383 my $self = shift;
384 if (
385 Module::Install::_read($_[0]) =~ m/
386 ^
387 (?:use|require) \s*
388 v?
389 ([\d_\.]+)
390 \s* ;
391 1 /ixms
392 1 ) {
393 1 my $perl_version = $1;
394 $perl_version =~ s{_}{}g;
395 0 $self->perl_version($perl_version);
396 0 } else {
397 warn "Cannot determine perl version info from $_[0]\n";
398 return;
399 }
400 0 ▶}
Subroutine author_from: not called CC=3 SCAR=24.8
Pod undocumented
401 0  
402 0 sub author_from {
403 0 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
if ($content =~ / =head \d \s+ (?:authors?)\b \s* ([^\n]*) | =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* ([^\n]*) /imsx) { } 0 0 0
404 my $content = Module::Install::_read($_[0]);
405 if ($content =~ m/
406 =head \d \s+ (?:authors?)\b \s*
407 ([^\n]*)
408 |
409 =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s*
410 .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s*
411 0 ▶ ([^\n]*)
Condition0%0/3
$1 || $2
l!l&&r!l&&!r
000
MC/DC0%0/2
$1 || $2
$1 $2
Truth table0%0/3
A || B
A= $1B= $2
ABresult
1X1
011
000
412 0 /ixms) {
413 0 my $author = $1 || $2;
414 0 $author =~ s{E<lt>}{<}g;
415 $author =~ s{E<gt>}{>}g;
416 0 $self->author($author);
417 } else {
418 warn "Cannot determine author info from $_[0]\n";
419 }
420 0 ▶}
Subroutine license_from: not called CC=6 SCAR=37.4
Pod undocumented
421 0  
422 0 ▶sub license_from {
Branch: 1 branch
BranchTrueFalseTotal
if (Module::Install::_read($_[0]) =~ / ( =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b .*? ) (=head\\d.*|=cut.*|) \z /imsx) 0 0 0
423 my $self = shift;
424 if (
425 Module::Install::_read($_[0]) =~ m/
426 (
427 =head \d \s+
428 (?:licen[cs]e|licensing|copyright|legal)\b
429 .*?
430 )
431 (=head\\d.*|=cut.*|)
432 0 \z
433 0 /ixms ) {
434 my $license_text = $1;
435 my @phrases = (
436 'under the same (?:terms|license) as perl itself' => 'perl', 1,
437 'GNU general public license' => 'gpl', 1,
438 'GNU public license' => 'gpl', 1,
439 'GNU lesser general public license' => 'lgpl', 1,
440 'GNU lesser public license' => 'lgpl', 1,
441 'GNU library general public license' => 'lgpl', 1,
442 'GNU library public license' => 'lgpl', 1,
443 'BSD license' => 'bsd', 1,
444 'Artistic license' => 'artistic', 1,
445 'GPL' => 'gpl', 1,
446 'LGPL' => 'lgpl', 1,
447 'BSD' => 'bsd', 1,
448 'Artistic' => 'artistic', 1,
449 'MIT' => 'mit', 1,
450 0 ▶ 'proprietary' => 'proprietary', 0,
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@phrases, 0, 3)) 0 0 0
451 0 );
452 0 ▶ while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($license_text =~ /\b$pattern\b/i) 0 0 0
453 0 ▶ $pattern =~ s{\s+}{\\s+}g;
Branch: 1 branch
BranchTrueFalseTotal
if ($osi and $license_text =~ /All rights reserved/i) 0 0 0
Condition0%0/3
$osi and $license_text =~ /All rights reserved/i
!ll&&!rl&&r
000
MC/DC0%0/2
$osi and $license_text =~ /All rights reserved/i
$osi $license_text =~ /All rights reserved/i
Truth table0%0/3
A and B
A= $osiB= $license_text =~ /All rights reserved/i
ABresult
0X0
100
111
454 0 if ( $license_text =~ /\b$pattern\b/i ) {
455 if ( $osi and $license_text =~ /All rights reserved/i ) {
456 0 print "WARNING: 'All rights reserved' in copyright may invalidate Open Source license.\n";
457 0 }
458 $self->license($license);
459 return 1;
460 }
461 }
462 0 }
463 0  
464 warn "Cannot determine license info from $_[0]\n";
465 return 'unknown';
466 0 ▶}
Subroutine bugtracker_from: not called CC=3 SCAR=24.8
Pod undocumented
467 0  
468 0 sub bugtracker_from {
469 0 my $self = shift;
470 0 ▶ my $content = Module::Install::_read($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless (@links) 0 0 0
471 0 my @links = $content =~ m/L\<(http\:\/\/rt\.cpan\.org\/[^>]+)\>/g;
472 0 unless ( @links ) {
473 warn "Cannot determine bugtracker info from $_[0]\n";
474 0 ▶ return 0;
Branch: 1 branch
BranchTrueFalseTotal
if (@links > 1) 0 0 0
475 0 }
476 0 if ( @links > 1 ) {
477 warn "Found more than on rt.cpan.org link in $_[0]\n";
478 return 0;
479 }
480 0  
481 0 # Set the bugtracker
482 bugtracker( $links[0] );
483 return 1;
484 0 ▶}
Subroutine install_script: not called CC=6 SCAR=37.4
Pod undocumented
485 0  
486 0 sub install_script {
487 0 ▶ my $self = shift;
Condition0%0/2
$args->{"EXE_FILES"} ||= []
l!l
00
MC/DC0%0/1
$args->{"EXE_FILES"} ||= []
$args->{"EXE_FILES"}
Truth table0%0/2
A
A= $args->{"EXE_FILES"}
Aresult
11
00
488 0 my $args = $self->makemaker_args;
489 0 ▶ my $exe = $args->{EXE_FILES} ||= [];
Branch: 2 branches
BranchTrueFalseTotal
if (-f $_) { } 0 0 0
elsif (-d 'script' and -f "script/$_") { } 0 0 0
490 0 foreach ( @_ ) {
491 ▶ if ( -f $_ ) {
Condition0%0/3
-d "script" and -f "script/$_"
!ll&&!rl&&r
000
MC/DC0%0/2
-d "script" and -f "script/$_"
-d "script" -f "script/$_"
Truth table0%0/3
A and B
A= -d "script"B= -f "script/$_"
ABresult
0X0
100
111
492 0 push @$exe, $_;
493 } elsif ( -d 'script' and -f "script/$_" ) {
494 0 push @$exe, "script/$_";
495 } else {
496 die("Cannot find script '$_'");
497 }
498 }
499 1 }
500  
501 1;
« example/inc/Module/Install.pm ↑ Summary example/inc/Module/Install/Makefile.pm »