| 1 | package App::findeps; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 25 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 25 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 25 | ▶ | use feature qw(state); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 25 | our $VERSION = "0.13"; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 25 | ▶ | use Carp qw(carp croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 25 | ▶ | use ExtUtils::Installed; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 25 | ▶ | use List::Util qw(first); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 25 | ▶ | use Module::CoreList; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 25 | ▶ | use Directory::Iterator; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 25 | our $Upgrade = 0; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 25 | our $myLib = 'lib'; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 25 | our $toCpanfile = 0; | |||||||||||||||||||||||||||||||||||||||||
| 19 | 25 | my $qr4ext = qr/\w+\.(p[ml]|t|cgi|psgi)$/; | |||||||||||||||||||||||||||||||||||||||||
| 20 | 25 | my $qr4name = qr/[a-zA-Z][a-zA-Z\d]+(?:::[a-zA-Z\d]+){0,}/; | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub scanDir { # To Do | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scanDir: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | my $dir = shift || $myLib || 'lib'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
shift() || $App::findeps::myLib || 'lib'
shift() or $App::findeps::myLib
MC/DC0%0/2
shift() || $App::findeps::myLib || 'lib'
shift()
$App::findeps::myLib
Truth table0%0/3
A or B
A= shift()B= $App::findeps::myLib
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | die "$dir is not a directory" unless -d $dir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my @list = (); | |||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my $list = Directory::Iterator->new($dir); | |||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | while ( $list->next ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | my $file = $list->get; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | next unless $file =~ /\.p[lm]$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | scan( file => $file, list => \@list ); | |||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | return @list; | |||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 25 | ▶ | sub scan { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scan: called CC=45 SCAR=38.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 25 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 25 | my %pairs; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 25 | ▶ | while ( my $file = shift @{ $args{files} } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 25 | ( my $ext = $file ) =~ $qr4ext; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 25 | ▶ | warn "Invalid extension was set: $ext" unless $1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 25 | ▶ | open my $fh, '<', $file or die "Can't open < $file: $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 25 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 381 | chomp; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 381 | ▶ | next unless defined $_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 381 | ▶ | last if /^__(?:END|DATA)__$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 380 | state( $pod, $here, $eval ); | |||||||||||||||||||||||||||||||||||||||||
| 48 | 380 | ▶ | next if $pod and $_ ne '=cut'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$pod and $_ ne "=cut"
MC/DC100%2/2
$pod and $_ ne "=cut"
$pod
$_ ne "=cut"
Truth table100%3/3
A and B
A= $podB= $_ ne "=cut"
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 349 | ▶ | next if $here and $_ ne $here; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$here and $_ ne $here
MC/DC100%2/2
$here and $_ ne $here
$here
$_ ne $here
Truth table100%3/3
A and B
A= $hereB= $_ ne $here
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 332 | ▶ | if ( !$pod and /^=(\w+)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
not $pod and /^=(\w+)/
MC/DC100%2/2
not $pod and /^=(\w+)/
not $pod
/^=(\w+)/
Truth table100%3/3
not(A) and B
A= not $podB= /^=(\w+)/
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 2 | $pod = $1; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||
| 53 | ▶ | } elsif ( $pod and $_ eq '=cut' ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$pod and $_ eq "=cut"
MC/DC50%1/2
$pod and $_ eq "=cut"
$pod
$_ eq "=cut"
Truth table66%2/3
A and B
A= $podB= $_ eq "=cut"
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 2 | undef $pod; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 328 | ▶ | if ( !$here and my @catch = /(?:<<(['"])?(\w+)\1?){1,}/g ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
not $here and my(@catch) = /(?:<<(['"])?(\w+)\1?){1,}/g
MC/DC100%2/2
not $here and my(@catch) = /(?:<<(['"])?(\w+)\1?){1,}/g
not $here
my(@catch) = /(?:<<(['"])?(\w+)\1?){1,}/g
Truth table100%3/3
not(A) and B
A= not $hereB= my(@catch) = /(?:<<(['"])?(\w+)\1?){1,}/g
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 4 | $here = $catch[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||
| 60 | ▶ | } elsif ( $here and $_ eq $here ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$here and $_ eq $here
MC/DC50%1/2
$here and $_ eq $here
$here
$_ eq $here
Truth table66%2/3
A and B
A= $hereB= $_ eq $here
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 4 | undef $here; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 320 | ▶ | next if /^\s*#.*/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 301 | s/\s+#.*$//; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 301 | ▶ | if ( !$eval and /eval\s*(['"{])$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
not $eval and /eval\s*(['"{])$/
MC/DC100%2/2
not $eval and /eval\s*(['"{])$/
not $eval
/eval\s*(['"{])$/
Truth table100%3/3
not(A) and B
A= not $evalB= /eval\s*(['"{])$/
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 3 | ▶ | $eval = $1 eq '{' ? '}' : $1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | ▶ | } elsif ( $eval and /$eval(?:.*)?;$/ ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$eval and /$eval(?:.*)?;$/
MC/DC100%2/2
$eval and /$eval(?:.*)?;$/
$eval
/$eval(?:.*)?;$/
Truth table100%3/3
A and B
A= $evalB= /$eval(?:.*)?;$/
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 3 | undef $eval; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 3 | next; | |||||||||||||||||||||||||||||||||||||||||
| 71 | ▶ | } elsif ( $eval and /\b(require|use)\s+($qr4name)/ ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$eval and /\b(require|use)\s+($qr4name)/
MC/DC100%2/2
$eval and /\b(require|use)\s+($qr4name)/
$eval
/\b(require|use)\s+($qr4name)/
Truth table100%3/3
A and B
A= $evalB= /\b(require|use)\s+($qr4name)/
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 3 | warnIgnored( $2, $1, 'eval' ); | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 298 | ▶ | next if $eval; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 291 | ▶ | if (/\buse\b/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 85 | scan_line( \%pairs, $_ ); | |||||||||||||||||||||||||||||||||||||||||
| 78 | 85 | next; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 206 | state $if = 0; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 206 | ▶ | if (/^\b(?:if|unless)\s*\(.*\)\s*{$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 8 | $if++; | |||||||||||||||||||||||||||||||||||||||||
| 84 | ▶ | } elsif ( $if > 0 and /^\s*}$/ ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$if > 0 and /^\s*}$/
MC/DC100%2/2
$if > 0 and /^\s*}$/
$if > 0
/^\s*}$/
Truth table100%3/3
A and B
A= $if > 0B= /^\s*}$/
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 8 | $if--; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 8 | ▶ | warn "something wrong to parse: $file" if $if < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 8 | next; | |||||||||||||||||||||||||||||||||||||||||
| 88 | ▶ | } elsif ( $if > 0 and /^\brequire\s+($qr4name)/ ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$if > 0 and /^\brequire\s+($qr4name)/
MC/DC0%0/2
$if > 0 and /^\brequire\s+($qr4name)/
$if > 0
/^\brequire\s+($qr4name)/
Truth table66%2/3
A and B
A= $if > 0B= /^\brequire\s+($qr4name)/
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | warnIgnored( 'require', $1, 'if' ); | |||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 198 | ▶ | next unless /\b(require|use)\s+/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 40 | scan_line( \%pairs, $_ ); | |||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 25 | close $fh; | |||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 25 | my $deps = {}; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 25 | my @local = (); | |||||||||||||||||||||||||||||||||||||||||
| 98 | 25 | my $list = Directory::Iterator->new($myLib) | |||||||||||||||||||||||||||||||||||||||||
| 99 | ; # To Do: $myLib must be got from local::lib within plenv/PerlBrew | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 25 | ▶ | while ( $list->next ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 52 | my $file = $list->get; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 52 | ▶ | next unless $file =~ s!\.pm$!!; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 52 | $file =~ s!/!::!g; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 52 | push @local, $file; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 25 | ▶ | while ( my ( $name, $version ) = each %pairs ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 37 | ▶ | next if !defined $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 37 | ▶ | next if exists $deps->{$name}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 37 | ▶ | next if first { $_ eq $name } @local; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 37 | ▶ | $deps->{$name} = $version if !defined $version or $Upgrade or $toCpanfile; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not defined $version or $App::findeps::Upgrade or $App::findeps::toCpanfile
not defined $version or $App::findeps::Upgrade
MC/DC33%1/3
not defined $version or $App::findeps::Upgrade or $App::findeps::toCpanfile
not defined $version
$App::findeps::Upgrade
$App::findeps::toCpanfile
Truth table50%2/4
not(A) or B or C
A= not defined $versionB= $App::findeps::UpgradeC= $App::findeps::toCpanfile
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 25 | return $deps; | |||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | # subroutines #----#----#----#----#----#----#----#----#----#----#----#----# | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 25 | my @pragmas = qw( | |||||||||||||||||||||||||||||||||||||||||
| 118 | attributes autodie autouse | ||||||||||||||||||||||||||||||||||||||||||
| 119 | base bigint bignum bigrat blib bytes | ||||||||||||||||||||||||||||||||||||||||||
| 120 | charnames constant diagnostics encoding | ||||||||||||||||||||||||||||||||||||||||||
| 121 | feature fields filetest if integer less lib locale mro | ||||||||||||||||||||||||||||||||||||||||||
| 122 | open ops overload overloading parent re | ||||||||||||||||||||||||||||||||||||||||||
| 123 | sigtrap sort strict subs | ||||||||||||||||||||||||||||||||||||||||||
| 124 | threads threads::shared utf8 vars vmsish | ||||||||||||||||||||||||||||||||||||||||||
| 125 | warnings warnings::register | ||||||||||||||||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 125 | ▶ | sub scan_line { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scan_line: called CC=19 SCAR=32.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 125 | my $pairs = shift; | |||||||||||||||||||||||||||||||||||||||||
| 130 | 125 | local $_ = shift; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 125 | my @names = (); | |||||||||||||||||||||||||||||||||||||||||
| 132 | 125 | ▶ | return if /^\buse\s+v5(?:\.\d{2}){1,2}\s*;/; #ignore VERSION | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 125 | ▶ | return if /^\buse\s+5\.\d{3}(?:_\d{3})?;/; #ignore old version | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 125 | ▶ | if (/use\s+(?:base|parent)\s+qw[\("']\s*((?:$qr4name\s*){1,})[\)"']/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | push @names, split /\s+/, $1; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } elsif (/use\s+(?:base|parent|autouse)\s+(['"])?($qr4name)\1?/) { | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 6 | $names[0] = $2; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } elsif (/eval\s*(['"{])\s*(require|use)\s+($qr4name).*(?:\1|})/) { | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 2 | warnIgnored( $3, $2, 'eval' ); | |||||||||||||||||||||||||||||||||||||||||
| 141 | ▶ | } elsif ( /(?:if|unless)\s+\(.*\)\s*\{.*require\s+($qr4name).*\}/ | |||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
/(?:if|unless)\s+\(.*\)\s*\{.*require\s+($qr4name).*\}/ or /require\s+($qr4name)\s+(?:if|unless)\s+\(?.*\)?/
MC/DC100%2/2
/(?:if|unless)\s+\(.*\)\s*\{.*require\s+($qr4name).*\}/ or /require\s+($qr4name)\s+(?:if|unless)\s+\(?.*\)?/
/(?:if|unless)\s+\(.*\)\s*\{.*require\s+($qr4name).*\}/
/require\s+($qr4name)\s+(?:if|unless)\s+\(?.*\)?/
Truth table100%3/3
A or B
A= /(?:if|unless)\s+\(.*\)\s*\{.*require\s+($qr4name).*\}/B= /require\s+($qr4name)\s+(?:if|unless)\s+\(?.*\)?/
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | or /require\s+($qr4name)\s+(?:if|unless)\s+\(?.*\)?/ ) | ||||||||||||||||||||||||||||||||||||||||||
| 143 | { | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 10 | warnIgnored( $1, 'require', 'if' ); | |||||||||||||||||||||||||||||||||||||||||
| 145 | } elsif (/^\s*(?:require|use)\s+($qr4name)/) { | ||||||||||||||||||||||||||||||||||||||||||
| 146 | 102 | $names[0] = $1; | |||||||||||||||||||||||||||||||||||||||||
| 147 | } elsif (m!^\s*require\s*(["'])((?:\./)?(?:\w+/){0,}$qr4name\.pm)\1!) { | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 4 | $names[0] = _name($2); | |||||||||||||||||||||||||||||||||||||||||
| 149 | } elsif (/^\s*(require|use)\s+(['"]?)(.*)\2/) { | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my $name = $3; | |||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | my $exists = ( -e "$myLib/$name" ) ? 'exists' : "does not exist in $myLib"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | warn "just detected but not listed: $name($exists) $1d\n"; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 125 | for my $name (@names) { | |||||||||||||||||||||||||||||||||||||||||
| 155 | 114 | ▶ | next unless defined $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 114 | ▶ | next if exists $pairs->{$name}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 108 | ▶ | next if $name eq 'Plack::Builder'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 108 | ▶ | next if first { $name eq $_ } @pragmas; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 37 | ▶ | next if !$Upgrade and Module::CoreList->is_core($name); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $App::findeps::Upgrade and "Module::CoreList"->is_core($name)
MC/DC0%0/2
not $App::findeps::Upgrade and "Module::CoreList"->is_core($name)
not $App::findeps::Upgrade
"Module::CoreList"->is_core($name)
Truth table33%1/3
not(A) and B
A= not $App::findeps::UpgradeB= "Module::CoreList"->is_core($name)
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 37 | $pairs->{$name} = get_version($name); | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 125 | return %$pairs; | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 37 | ▶ | sub get_version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_version: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 37 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 37 | my $installed = ExtUtils::Installed->new( skip_cwd => 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 168 | 37 | ▶ | my $module = first { $_ eq $name } $installed->modules(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 37 | my $version = eval { $installed->version($module) }; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 37 | ▶ | return $version if defined $version; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 25 | ▶ | eval "use lib '$myLib'; require $name" or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 9 | ▶ | return eval "no strict 'subs';\$${name}::VERSION"; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 15 | ▶ | sub warnIgnored { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warnIgnored: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 15 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 15 | my $func = shift; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 15 | my $cmd = shift; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 15 | ▶ | warn "$name is ${func}d inside of '$cmd'\n" unless Module::CoreList->is_core($name); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 32 | ▶ | sub _name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_name: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 32 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||
| 184 | 32 | ▶ | $str =~ s!/!::!g if $str =~ /\.pm$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 32 | $str =~ s!^lib::!!; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 32 | $str =~ s!\.pm$!!; | |||||||||||||||||||||||||||||||||||||||||
| 187 | 32 | $str =~ s!^auto::(.+)::.*!$1!; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 32 | return $str; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 25 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | __END__ | ||||||||||||||||||||||||||||||||||||||||||