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