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