| 1 | package Module::Install::Share; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 46 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 46 | ▶ | use Module::Install::Base (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 46 | ▶ | use File::Find (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 46 | ▶ | use ExtUtils::Manifest (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 46 | ▶ | use vars qw{$VERSION @ISA $ISCORE}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 46 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 46 | $VERSION = '1.21'; | |||||||||||||||||||||||||||||||||||||||||||||
| 11 | 46 | @ISA = 'Module::Install::Base'; | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 46 | $ISCORE = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | ▶ | sub install_share { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_share: called CC=15 SCAR=32.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | 4 | ▶ | my $dir = @_ ? pop : 'share'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | ▶ | my $type = @_ ? shift : 'dist'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 4 | ▶ | unless ( defined $type and $type eq 'module' or $type eq 'dist' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $type and $type eq "module" or $type eq "dist"
defined $type and $type eq "module"
MC/DC0%0/3
defined $type and $type eq "module" or $type eq "dist"
defined $type
$type eq "module"
$type eq "dist"
Truth table20%1/5
A and B or C
A= defined $typeB= $type eq "module"C= $type eq "dist"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | die "Illegal or invalid share dir type '$type'"; | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 4 | ▶ | unless ( defined $dir and -d $dir ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $dir and -d $dir
MC/DC0%0/2
defined $dir and -d $dir
defined $dir
-d $dir
Truth table33%1/3
A and B
A= defined $dirB= -d $dir
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | Carp::croak("Illegal or missing directory install_share param: '$dir'"); | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # Split by type | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 4 | ▶ | my $S = ($^O eq 'MSWin32') ? "\\" : "\/"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | my $root; | |||||||||||||||||||||||||||||||||||||||||||||
| 31 | 4 | ▶ | if ( $type eq 'dist' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 4 | ▶ | die "Too many parameters to install_share" if @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # Set up the install | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | $root = "\$(INST_LIB)${S}auto${S}share${S}dist${S}\$(DISTNAME)"; | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my $module = Module::Install::_CLASS($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | unless ( defined $module ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | die "Missing or invalid module name '$_[0]'"; | |||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $module =~ s/::/-/g; | |||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | $root = "\$(INST_LIB)${S}auto${S}share${S}module${S}$module"; | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 4 | ▶ | my $manifest = -r 'MANIFEST' ? ExtUtils::Manifest::maniread() : undef; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 4 | ▶ | my $skip_checker = $ExtUtils::Manifest::VERSION >= 1.54 | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ? ExtUtils::Manifest::maniskip() | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | : ExtUtils::Manifest::_maniskip(); | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 4 | my $postamble = ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | 4 | ▶ | my $perm_dir = eval($ExtUtils::MakeMaker::VERSION) >= 6.52 ? '$(PERM_DIR)' : 755; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | File::Find::find({ | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | no_chdir => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 8 | ▶ | wanted => sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 8 | my $path = File::Spec->abs2rel($_, $dir); | |||||||||||||||||||||||||||||||||||||||||||||
| 56 | 8 | ▶ | if (-d $_) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 4 | ▶ | return if $skip_checker->($File::Find::name); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 4 | $postamble .=<<"END"; | |||||||||||||||||||||||||||||||||||||||||||||
| 59 | \t\$(NOECHO) \$(MKPATH) "$root${S}$path" | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | \t\$(NOECHO) \$(CHMOD) $perm_dir "$root${S}$path" | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | END | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | return if ref $manifest | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 4 | ▶ | && !exists $manifest->{$File::Find::name}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $manifest and not exists $manifest->{$File::Find::name}
MC/DC50%1/2
ref $manifest and not exists $manifest->{$File::Find::name}
ref $manifest
not exists $manifest->{$File::Find::name}
Truth table66%2/3
A and not(B)
A= ref $manifestB= not exists $manifest->{$File::Find::name}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 2 | ▶ | return if $skip_checker->($File::Find::name); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | $postamble .=<<"END"; | |||||||||||||||||||||||||||||||||||||||||||||
| 68 | \t\$(NOECHO) \$(CP) "$dir${S}$path" "$root${S}$path" | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | END | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 4 | }, $dir); | |||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # Set up the install | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 4 | $self->postamble(<<"END_MAKEFILE"); | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | config :: | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | $postamble | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | END_MAKEFILE | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # The above appears to behave incorrectly when used with old versions | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # of ExtUtils::Install (known-bad on RHEL 3, with 5.8.0) | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # So when we need to install a share directory, make sure we add a | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # dependency on a moderately new version of ExtUtils::MakeMaker. | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 4 | $self->build_requires( 'ExtUtils::MakeMaker' => '6.11' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # 99% of the time we don't want to index a shared dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 4 | $self->no_index( directory => $dir ); | |||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 46 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||