| 1 | #line 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2 | package Module::Install; | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | # For any maintainers: | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # The load order for Module::Install is a bit magic. | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # It goes something like this... | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # IF ( host has Module::Install installed, creating author mode ) { | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # 1. Makefile.PL calls "use inc::Module::Install" | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install | ||||||||||||||||||||||||||||||||||||||||||
| 11 | # 3. The installed version of inc::Module::Install loads | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # 4. inc::Module::Install calls "require Module::Install" | ||||||||||||||||||||||||||||||||||||||||||
| 13 | # 5. The ./inc/ version of Module::Install loads | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # } ELSE { | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # 1. Makefile.PL calls "use inc::Module::Install" | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # 3. The ./inc/ version of Module::Install loads | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use 5.005; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use strict 'vars'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use Cwd (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use File::Find (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | use File::Path (); | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | use vars qw{$VERSION $MAIN}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # All Module::Install core packages now require synchronised versions. | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # This will be used to ensure we don't accidentally load old or | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # different versions of modules. | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # This is not enforced yet, but will be some time in the next few | ||||||||||||||||||||||||||||||||||||||||||
| 32 | # releases once we can make sure it won't clash with custom | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | # Module::Install extensions. | |||||||||||||||||||||||||||||||||||||||||
| 34 | $VERSION = '1.04'; | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | # Storage for the pseudo-singleton | |||||||||||||||||||||||||||||||||||||||||
| 37 | $MAIN = undef; | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | *inc::Module::Install::VERSION = *VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 40 | @inc::Module::Install::ISA = __PACKAGE__; | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 2 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=12 SCAR=33.4
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 2 | sub import { | |||||||||||||||||||||||||||||||||||||||||
| 45 | 2 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | my $self = $class->new(@_); | |||||||||||||||||||||||||||||||||||||||||
| 47 | my $who = $self->_caller; | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 50 | # all of the following checks should be included in import(), | ||||||||||||||||||||||||||||||||||||||||||
| 51 | # to allow "eval 'require Module::Install; 1' to test | ||||||||||||||||||||||||||||||||||||||||||
| 52 | # installation of Module::Install. (RT #51267) | ||||||||||||||||||||||||||||||||||||||||||
| 53 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | # Whether or not inc::Module::Install is actually loaded, the | ||||||||||||||||||||||||||||||||||||||||||
| 56 | # $INC{inc/Module/Install.pm} is what will still get set as long as | ||||||||||||||||||||||||||||||||||||||||||
| 57 | # the caller loaded module this in the documented manner. | ||||||||||||||||||||||||||||||||||||||||||
| 58 | # If not set, the caller may NOT have loaded the bundled version, and thus | ||||||||||||||||||||||||||||||||||||||||||
| 59 | # they may not have a MI version that works with the Makefile.PL. This would | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 2 | # result in false errors or unexpected behaviour. And we don't want that. | |||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | unless ( $INC{$file} ) { die <<"END_DIE" } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 64 | Please invoke ${\__PACKAGE__} with: | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 66 | use inc::${\__PACKAGE__}; | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | not: | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 70 | use ${\__PACKAGE__}; | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | END_DIE | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | # This reportedly fixes a rare Win32 UTC file time issue, but | ||||||||||||||||||||||||||||||||||||||||||
| 75 | # as this is a non-cross-platform XS module not in the core, | ||||||||||||||||||||||||||||||||||||||||||
| 76 | # we shouldn't really depend on it. See RT #24194 for detail. | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | ▶ | # (Also, this module only supports Perl 5.6 and above). | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$^O eq "MSWin32" and $] >= "5.006"
MC/DC0%0/2
$^O eq "MSWin32" and $] >= "5.006"
$^O eq "MSWin32"
$] >= "5.006"
Truth table33%1/3
A and B
A= $^O eq "MSWin32"B= $] >= "5.006"
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | eval "use Win32::UTCFileTime" if $^O eq 'MSWin32' && $] >= 5.006; | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | # If the script that is loading Module::Install is from the future, | ||||||||||||||||||||||||||||||||||||||||||
| 81 | # then make will detect this and cause it to re-run over and over | ||||||||||||||||||||||||||||||||||||||||||
| 82 | # again. This is bad. Rather than taking action to touch it (which | ||||||||||||||||||||||||||||||||||||||||||
| 83 | # is unreliable on some platforms and requires write permissions) | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | ▶ | # for now we should catch this and refuse to run. | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 2 | if ( -f $0 ) { | |||||||||||||||||||||||||||||||||||||||||
| 86 | my $s = (stat($0))[9]; | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | # If the modification time is only slightly in the future, | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 2 | # sleep briefly to remove the problem. | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | my $a = $s - time; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$a > 0 and $a < 5
MC/DC0%0/2
$a > 0 and $a < 5
$a > 0
$a < 5
Truth table33%1/3
A and B
A= $a > 0B= $a < 5
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | if ( $a > 0 and $a < 5 ) { sleep 5 } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | # Too far in the future, throw an error. | |||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | my $t = time; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | if ( $s > $t ) { die <<"END_DIE" } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | Your installer $0 has a modification time in the future ($s > $t). | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | This is known to create infinite loops in make. | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | Please correct this, then run $0 again. | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | END_DIE | ||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | # Build.PL was formerly supported, but no longer is due to excessive | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | # difficulty in implementing every single feature twice. | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | Module::Install no longer supports Build.PL. | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | It was impossible to maintain duel backends, and has been deprecated. | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | Please remove all Build.PL files and only use the Makefile.PL installer. | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | END_DIE | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | # To save some more typing in Module::Install installers, every... | ||||||||||||||||||||||||||||||||||||||||||
| 122 | # use inc::Module::Install | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 2 | # ...also acts as an implicit use strict. | |||||||||||||||||||||||||||||||||||||||||
| 124 | $^H |= strict::bits(qw(refs subs vars)); | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 2 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | unless ( -f $self->{file} ) { | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | foreach my $key (keys %INC) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | delete $INC{$key} if $key =~ /Module\/Install/; | ||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | local $^W; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | require "$self->{path}/$self->{dispatch}.pm"; | |||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | File::Path::mkpath("$self->{prefix}/$self->{author}"); | |||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); | |||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $self->{admin}->init; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | @_ = ($class, _self => $self); | |||||||||||||||||||||||||||||||||||||||||
| 139 | goto &{"$self->{name}::import"}; | ||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 2 | local $^W; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 2 | *{"${who}::AUTOLOAD"} = $self->autoload; | |||||||||||||||||||||||||||||||||||||||||
| 144 | $self->preload; | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 2 | # Unregister loader and worker packages so subdirs can use them again | |||||||||||||||||||||||||||||||||||||||||
| 147 | 2 | delete $INC{'inc/Module/Install.pm'}; | |||||||||||||||||||||||||||||||||||||||||
| 148 | delete $INC{'Module/Install.pm'}; | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 2 | # Save to the singleton | |||||||||||||||||||||||||||||||||||||||||
| 151 | $MAIN = $self; | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 153 | return 1; | ||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 52 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
autoload: called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 52 | sub autoload { | |||||||||||||||||||||||||||||||||||||||||
| 157 | 52 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 52 | my $who = $self->_caller; | |||||||||||||||||||||||||||||||||||||||||
| 159 | 52 | my $cwd = Cwd::cwd(); | |||||||||||||||||||||||||||||||||||||||||
| 160 | 64 | ▶ | my $sym = "${who}::AUTOLOAD"; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=23.7
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 64 | $sym->{$cwd} = sub { | |||||||||||||||||||||||||||||||||||||||||
| 162 | 64 | ▶ | my $pwd = Cwd::cwd(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | if ( my $code = $sym->{$pwd} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 64 | ▶ | # Delegate back to parent dirs | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | goto &$code unless $cwd eq $pwd; | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 64 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | unless ($$sym =~ s/([^:]+)$//) { | ||||||||||||||||||||||||||||||||||||||||||
| 168 | # XXX: it looks like we can't retrieve the missing function | ||||||||||||||||||||||||||||||||||||||||||
| 169 | # via $$sym (usually $main::AUTOLOAD) in this case. | ||||||||||||||||||||||||||||||||||||||||||
| 170 | # I'm still wondering if we should slurp Makefile.PL to | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | # get some context or not ... | |||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my ($package, $file, $line) = caller; | |||||||||||||||||||||||||||||||||||||||||
| 173 | die <<"EOT"; | ||||||||||||||||||||||||||||||||||||||||||
| 174 | Unknown function is found at $file line $line. | ||||||||||||||||||||||||||||||||||||||||||
| 175 | Execution of $file aborted due to runtime errors. | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | If you're a contributor to a project, you may need to install | ||||||||||||||||||||||||||||||||||||||||||
| 178 | some Module::Install extensions from CPAN (or other repository). | ||||||||||||||||||||||||||||||||||||||||||
| 179 | If you're a user of a module, please contact the author. | ||||||||||||||||||||||||||||||||||||||||||
| 180 | EOT | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 64 | } | |||||||||||||||||||||||||||||||||||||||||
| 182 | 64 | ▶ | my $method = $1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | if ( uc($method) eq $method ) { | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | # Do nothing | |||||||||||||||||||||||||||||||||||||||||
| 185 | ▶ | return; | |||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$method =~ /^_/ and $self->can($method)
MC/DC0%0/2
$method =~ /^_/ and $self->can($method)
$method =~ /^_/
$self->can($method)
Truth table33%1/3
A and B
A= $method =~ /^_/B= $self->can($method)
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | } elsif ( $method =~ /^_/ and $self->can($method) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | # Dispatch to the root M:I class | |||||||||||||||||||||||||||||||||||||||||
| 188 | return $self->$method(@_); | ||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 64 | # Dispatch to the appropriate plugin | |||||||||||||||||||||||||||||||||||||||||
| 192 | 64 | unshift @_, ( $self, $1 ); | |||||||||||||||||||||||||||||||||||||||||
| 193 | 52 | goto &{$self->can('call')}; | |||||||||||||||||||||||||||||||||||||||||
| 194 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 2 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preload: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 2 | sub preload { | |||||||||||||||||||||||||||||||||||||||||
| 198 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 2 | unless ( $self->{extensions} ) { | |||||||||||||||||||||||||||||||||||||||||
| 200 | $self->load_extensions( | ||||||||||||||||||||||||||||||||||||||||||
| 201 | "$self->{prefix}/$self->{path}", $self | ||||||||||||||||||||||||||||||||||||||||||
| 202 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 2 | ▶ | my @exts = @{$self->{extensions}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | unless ( @exts ) { | |||||||||||||||||||||||||||||||||||||||||
| 207 | @exts = $self->{admin}->load_all_extensions; | ||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 2 | my %seen; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 14 | ▶ | foreach my $obj ( @exts ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 314 | ▶ | while (my ($method, $glob) = each %{ref($obj) . '::'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 264 | ▶ | next unless $obj->can($method); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 248 | ▶ | next if $method =~ /^_/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 216 | next if $method eq uc($method); | |||||||||||||||||||||||||||||||||||||||||
| 216 | $seen{$method}++; | ||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 220 | 2 | my $who = $self->_caller; | |||||||||||||||||||||||||||||||||||||||||
| 221 | 166 | foreach my $name ( sort keys %seen ) { | |||||||||||||||||||||||||||||||||||||||||
| 222 | 166 | ▶ | local $^W; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 14 | *{"${who}::$name"} = sub { | |||||||||||||||||||||||||||||||||||||||||
| 224 | 14 | ${"${who}::AUTOLOAD"} = "${who}::$name"; | |||||||||||||||||||||||||||||||||||||||||
| 225 | 166 | goto &{"${who}::AUTOLOAD"}; | |||||||||||||||||||||||||||||||||||||||||
| 226 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 2 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=13 SCAR=29.6
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 2 | sub new { | |||||||||||||||||||||||||||||||||||||||||
| 231 | my ($class, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 233 | delete $INC{'FindBin.pm'}; | ||||||||||||||||||||||||||||||||||||||||||
| 234 | { | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 2 | ▶ | # to suppress the redefine warning | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 2 | local $SIG{__WARN__} = sub {}; | |||||||||||||||||||||||||||||||||||||||||
| 237 | require FindBin; | ||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 2 | # ignore the prefix on extension modules built from top level. | |||||||||||||||||||||||||||||||||||||||||
| 241 | 2 | ▶ | my $base_path = Cwd::abs_path($FindBin::Bin); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { | |||||||||||||||||||||||||||||||||||||||||
| 243 | delete $args{prefix}; | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 2 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | return $args{_self} if $args{_self}; | ||||||||||||||||||||||||||||||||||||||||||
| 246 | 2 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"dispatch"} ||= "Admin"
MC/DC0%0/1
$args{"dispatch"} ||= "Admin"
$args{"dispatch"}
Truth table50%1/2
A
A= $args{"dispatch"}
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 2 | ▶ | $args{dispatch} ||= 'Admin'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"prefix"} ||= "inc"
MC/DC0%0/1
$args{"prefix"} ||= "inc"
$args{"prefix"}
Truth table50%1/2
A
A= $args{"prefix"}
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 2 | ▶ | $args{prefix} ||= 'inc'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"author"} ||= $^O eq "VMS" ? "_author" : ".author"
MC/DC0%0/2
$args{"author"} ||= $^O eq "VMS" ? "_author" : ".author"
$args{"author"}
$^O eq "VMS" ? "_author" : ".author"
Truth table33%1/3
A ||= B
A= $args{"author"}B= $^O eq "VMS" ? "_author" : ".author"
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 2 | ▶ | $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"bundle"} ||= "inc/BUNDLES"
MC/DC0%0/1
$args{"bundle"} ||= "inc/BUNDLES"
$args{"bundle"}
Truth table50%1/2
A
A= $args{"bundle"}
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 2 | ▶ | $args{bundle} ||= 'inc/BUNDLES'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args{"base"} ||= $base_path
MC/DC0%0/2
$args{"base"} ||= $base_path
$args{"base"}
$base_path
Truth table33%1/3
A ||= B
A= $args{"base"}B= $base_path
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 2 | $args{base} ||= $base_path; | |||||||||||||||||||||||||||||||||||||||||
| 252 | 2 | ▶ | $class =~ s/^\Q$args{prefix}\E:://; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args{"name"} ||= $class
MC/DC0%0/2
$args{"name"} ||= $class
$args{"name"}
$class
Truth table33%1/3
A ||= B
A= $args{"name"}B= $class
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 2 | ▶ | $args{name} ||= $class; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args{"version"} ||= $class->VERSION
MC/DC0%0/2
$args{"version"} ||= $class->VERSION
$args{"version"}
$class->VERSION
Truth table33%1/3
A ||= B
A= $args{"version"}B= $class->VERSION
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 2 | ▶ | $args{version} ||= $class->VERSION; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 2 | unless ( $args{path} ) { | |||||||||||||||||||||||||||||||||||||||||
| 256 | 2 | $args{path} = $args{name}; | |||||||||||||||||||||||||||||||||||||||||
| 257 | $args{path} =~ s!::!/!g; | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 2 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"file"} ||= qq[$args{"base"}/$args{"prefix"}/$args{"path"}.pm]
MC/DC0%0/1
$args{"file"} ||= qq[$args{"base"}/$args{"prefix"}/$args{"path"}.pm]
$args{"file"}
Truth table50%1/2
A
A= $args{"file"}
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 2 | $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; | |||||||||||||||||||||||||||||||||||||||||
| 260 | $args{wrote} = 0; | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 262 | bless( \%args, $class ); | ||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 64 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 64 | sub call { | |||||||||||||||||||||||||||||||||||||||||
| 266 | 64 | ▶ | my ($self, $method) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 64 | my $obj = $self->load($method) or return; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 64 | splice(@_, 0, 2, $obj); | |||||||||||||||||||||||||||||||||||||||||
| 269 | goto &{$obj->can($method)}; | ||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 68 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=5 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 68 | sub load { | |||||||||||||||||||||||||||||||||||||||||
| 273 | my ($self, $method) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | $self->load_extensions( | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 68 | ▶ | "$self->{prefix}/$self->{path}", $self | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | ) unless $self->{extensions}; | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 68 | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 326 | ▶ | foreach my $obj (@{$self->{extensions}}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | return $obj if $obj->can($method); | ||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | my $admin = $self->{admin} or die <<"END_DIE"; | ||||||||||||||||||||||||||||||||||||||||||
| 284 | The '$method' method does not exist in the '$self->{prefix}' path! | ||||||||||||||||||||||||||||||||||||||||||
| 285 | Please remove the '$self->{prefix}' directory and run $0 again to load it. | ||||||||||||||||||||||||||||||||||||||||||
| 286 | END_DIE | ||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | my $obj = $admin->load($method, 1); | |||||||||||||||||||||||||||||||||||||||||
| 289 | push @{$self->{extensions}}, $obj; | ||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 291 | $obj; | ||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | 2 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_extensions: called CC=9 SCAR=23.9
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 2 | sub load_extensions { | |||||||||||||||||||||||||||||||||||||||||
| 295 | my ($self, $path, $top) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 297 | 2 | ▶ | my $should_reload = 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
!ref($_) && lc $_ eq lc $self->{'prefix'}
MC/DC0%0/2
!ref($_) && lc $_ eq lc $self->{'prefix'}
!ref($_)
lc $_ eq lc $self->{'prefix'}
Truth table33%1/3
not(A) && B
A= !ref($_)B= lc $_ eq lc $self->{'prefix'}
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 2 | unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) { | |||||||||||||||||||||||||||||||||||||||||
| 299 | 2 | unshift @INC, $self->{prefix}; | |||||||||||||||||||||||||||||||||||||||||
| 300 | $should_reload = 1; | ||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 302 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 14 | foreach my $rv ( $self->find_extensions($path) ) { | |||||||||||||||||||||||||||||||||||||||||
| 304 | 14 | ▶ | my ($file, $pkg) = @{$rv}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | next if $self->{pathnames}{$pkg}; | ||||||||||||||||||||||||||||||||||||||||||
| 306 | 14 | ||||||||||||||||||||||||||||||||||||||||||
| 307 | 14 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 308 | 14 | ▶ | my $new = eval { local $^W; require $file; $pkg->can('new') }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | unless ( $new ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | warn $@ if $@; | |||||||||||||||||||||||||||||||||||||||||
| 311 | next; | ||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 14 | ▶ | $self->{pathnames}{$pkg} = | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 14 | $should_reload ? delete $INC{$file} : $INC{$file}; | |||||||||||||||||||||||||||||||||||||||||
| 315 | push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); | ||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 2 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"extensions"} ||= []
MC/DC0%0/1
$self->{"extensions"} ||= []
$self->{"extensions"}
Truth table50%1/2
A
A= $self->{"extensions"}
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | $self->{extensions} ||= []; | ||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | 2 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_extensions: called CC=2 SCAR=10.5
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 2 | sub find_extensions { | |||||||||||||||||||||||||||||||||||||||||
| 322 | my ($self, $path) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 323 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 16 | ▶ | my @found; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=12 SCAR=39.7
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 16 | File::Find::find( sub { | |||||||||||||||||||||||||||||||||||||||||
| 326 | 16 | ▶ | my $file = $File::Find::name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | 14 | return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; | |||||||||||||||||||||||||||||||||||||||||
| 328 | 14 | ▶ | my $subpath = $1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | return if lc($subpath) eq lc($self->{dispatch}); | ||||||||||||||||||||||||||||||||||||||||||
| 330 | 14 | ||||||||||||||||||||||||||||||||||||||||||
| 331 | 14 | $file = "$self->{path}/$subpath.pm"; | |||||||||||||||||||||||||||||||||||||||||
| 332 | 14 | my $pkg = "$self->{name}::$subpath"; | |||||||||||||||||||||||||||||||||||||||||
| 333 | $pkg =~ s!/!::!g; | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | # If we have a mixed-case package name, assume case has been preserved | ||||||||||||||||||||||||||||||||||||||||||
| 336 | # correctly. Otherwise, root through the file to locate the case-preserved | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 14 | ▶ | # version of the package name. | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$subpath eq lc $subpath or $subpath eq uc $subpath
MC/DC0%0/2
$subpath eq lc $subpath or $subpath eq uc $subpath
$subpath eq lc $subpath
$subpath eq uc $subpath
Truth table33%1/3
A or B
A= $subpath eq lc $subpathB= $subpath eq uc $subpath
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { | |||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | my $content = Module::Install::_read($subpath . '.pm'); | |||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my $in_pod = 0; | |||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | foreach ( split //, $content ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | $in_pod = 1 if /^=\w/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | $in_pod = 0 if /^=cut/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$in_pod or /^=cut/
MC/DC0%0/2
$in_pod or /^=cut/
$in_pod
/^=cut/
Truth table0%0/3
A or B
A= $in_podB= /^=cut/
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | next if ($in_pod || /^=cut/); # skip pod text | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | next if /^\s*#/; # and comments | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | if ( m/^\s*package\s+($pkg)\s*;/i ) { | |||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | $pkg = $1; | |||||||||||||||||||||||||||||||||||||||||
| 348 | last; | ||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 352 | 14 | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 2 | ▶ | push @found, [ $file, $pkg ]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | }, $path ) if -d $path; | ||||||||||||||||||||||||||||||||||||||||||
| 355 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 356 | @found; | ||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | ##################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 364 | # Common Utility Functions | ||||||||||||||||||||||||||||||||||||||||||
| 365 | 56 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_caller: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | 56 | sub _caller { | |||||||||||||||||||||||||||||||||||||||||
| 367 | 56 | my $depth = 0; | |||||||||||||||||||||||||||||||||||||||||
| 368 | 56 | ▶ | my $call = caller($depth); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | 60 | while ( $call eq __PACKAGE__ ) { | |||||||||||||||||||||||||||||||||||||||||
| 370 | 60 | $depth++; | |||||||||||||||||||||||||||||||||||||||||
| 371 | $call = caller($depth); | ||||||||||||||||||||||||||||||||||||||||||
| 372 | 56 | } | |||||||||||||||||||||||||||||||||||||||||
| 373 | return $call; | ||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 6 | ▶ | # Done in evals to avoid confusing Perl::MinimumVersion | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read: called CC=3 SCAR=11.4
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||
| 378 | sub _read { | ||||||||||||||||||||||||||||||||||||||||||
| 379 | local *FH; | ||||||||||||||||||||||||||||||||||||||||||
| 380 | open( FH, '<', $_[0] ) or die "open($_[0]): $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 381 | my $string = do { local $/; <FH> }; | ||||||||||||||||||||||||||||||||||||||||||
| 382 | close FH or die "close($_[0]): $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 383 | return $string; | ||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 385 | END_NEW | ||||||||||||||||||||||||||||||||||||||||||
| 386 | sub _read { | ||||||||||||||||||||||||||||||||||||||||||
| 387 | local *FH; | ||||||||||||||||||||||||||||||||||||||||||
| 388 | open( FH, "< $_[0]" ) or die "open($_[0]): $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 389 | my $string = do { local $/; <FH> }; | ||||||||||||||||||||||||||||||||||||||||||
| 390 | close FH or die "close($_[0]): $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 391 | return $string; | ||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | END_OLD | ||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_readperl: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | sub _readperl { | |||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | my $string = Module::Install::_read($_[0]); | |||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; | |||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | $string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s; | |||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg; | |||||||||||||||||||||||||||||||||||||||||
| 400 | return $string; | ||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_readpod: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | sub _readpod { | |||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | my $string = Module::Install::_read($_[0]); | |||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | return $string if $_[0] =~ /\.pod\z/; | |||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | $string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg; | |||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | $string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg; | |||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | $string =~ s/^\n+//s; | |||||||||||||||||||||||||||||||||||||||||
| 411 | return $string; | ||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | # Done in evals to avoid confusing Perl::MinimumVersion | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_write: not called CC=5 SCAR=27.8
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||
| 416 | sub _write { | ||||||||||||||||||||||||||||||||||||||||||
| 417 | local *FH; | ||||||||||||||||||||||||||||||||||||||||||
| 418 | open( FH, '>', $_[0] ) or die "open($_[0]): $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 419 | foreach ( 1 .. $#_ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 420 | print FH $_[$_] or die "print($_[0]): $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | close FH or die "close($_[0]): $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||
| 424 | END_NEW | ||||||||||||||||||||||||||||||||||||||||||
| 425 | sub _write { | ||||||||||||||||||||||||||||||||||||||||||
| 426 | local *FH; | ||||||||||||||||||||||||||||||||||||||||||
| 427 | open( FH, "> $_[0]" ) or die "open($_[0]): $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 428 | foreach ( 1 .. $#_ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 429 | print FH $_[$_] or die "print($_[0]): $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 431 | close FH or die "close($_[0]): $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 433 | END_OLD | ||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | # _version is for processing module versions (eg, 1.03_05) not | ||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | ▶ | # Perl versions (eg, 5.8.1). | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_version: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | sub _version ($) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | my $s = shift || 0; | |||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | my $d =()= $s =~ /(\.)/g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | if ( $d >= 2 ) { | ||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | # Normalise multipart versions | |||||||||||||||||||||||||||||||||||||||||
| 442 | $s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg; | ||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | $s =~ s/^(\d+)\.?//; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$1 || 0
MC/DC0%0/1
$1 || 0
$1
Truth table0%0/2
A
A= $1
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | my $l = $1 || 0; | ||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | my @v = map { | |||||||||||||||||||||||||||||||||||||||||
| 447 | $_ . '0' x (3 - length $_) | ||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | } $s =~ /(\d{1,3})\D?/g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | $l = $l . '.' . join '', @v if @v; | |||||||||||||||||||||||||||||||||||||||||
| 450 | return $l + 0; | ||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cmp: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | sub _cmp ($$) { | |||||||||||||||||||||||||||||||||||||||||
| 454 | _version($_[1]) <=> _version($_[2]); | ||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | # Cloned from Params::Util::_CLASS | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_CLASS: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | sub _CLASS ($) { | ||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $_[0] and not ref $_[0] and $_[0] =~ /^[^\W\d]\w*(?:::\w+)*\z/s
defined $_[0] and not ref $_[0]
MC/DC0%0/3
defined $_[0] and not ref $_[0] and $_[0] =~ /^[^\W\d]\w*(?:::\w+)*\z/s
defined $_[0]
not ref $_[0]
$_[0] =~ /^[^\W\d]\w*(?:::\w+)*\z/s
Truth table0%0/4
A and not(B) and C
A= defined $_[0]B= not ref $_[0]C= $_[0] =~ /^[^\W\d]\w*(?:::\w+)*\z/s
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | defined $_[0] | ||||||||||||||||||||||||||||||||||||||||||
| 461 | and | ||||||||||||||||||||||||||||||||||||||||||
| 462 | ! ref $_[0] | ||||||||||||||||||||||||||||||||||||||||||
| 463 | and | ||||||||||||||||||||||||||||||||||||||||||
| 464 | $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s | ||||||||||||||||||||||||||||||||||||||||||
| 465 | ) ? $_[0] : undef; | ||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||
| 467 | 2 | ||||||||||||||||||||||||||||||||||||||||||
| 468 | 1; | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | # Copyright 2008 - 2011 Adam Kennedy. | ||||||||||||||||||||||||||||||||||||||||||