| 1 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use FindBin qw( $Bin $RealBin ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Tie::File; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | exit 0 unless $ENV{dan} || $ENV{box} || $ENV{def}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$ENV{"dan"} or $ENV{"box"} or $ENV{"def"}
$ENV{"dan"} or $ENV{"box"}
MC/DC0%0/3
$ENV{"dan"} or $ENV{"box"} or $ENV{"def"}
$ENV{"dan"}
$ENV{"box"}
$ENV{"def"}
Truth table0%0/4
A or B or C
A= $ENV{"dan"}B= $ENV{"box"}C= $ENV{"def"}
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 0 | my @p = split /\//, $RealBin; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | ▶ | while ( @p ) { $p[-1] eq 'mydan' ? last : pop @p; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | ▶ | my $mydan = @p ? join( '/', @p ) : '/opt/mydan'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | system "mkdir -p '$mydan'" unless -e $mydan; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | my $perl = $ENV{PERL_PATH} || $^X; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$ENV{'PERL_PATH'} || $^X
MC/DC0%0/2
$ENV{'PERL_PATH'} || $^X
$ENV{'PERL_PATH'}
$^X
Truth table0%0/3
A || B
A= $ENV{'PERL_PATH'}B= $^X
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | my $cpan = $perl;$cpan =~ s/perl$/cpan/; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | $cpan = $ENV{cpan} unless -f $cpan; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | die "no find cpan" unless -f $cpan; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | sub mysystem | ||||||||||||||||||||||||||||||||||||||||||
| 20 | { | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | my $cmd = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mysystem: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | die "$cmd fail:$!" if system $cmd; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | sub repl | ||||||||||||||||||||||||||||||||||||||||||
| 26 | { | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | my ( $type, %reg ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
repl: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | for my $file ( `find $type -type f` ) | |||||||||||||||||||||||||||||||||||||||||
| 29 | { | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | chomp $file; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | tie my ( @file ), 'Tie::File', $file; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if( @file ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if( %reg ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | { | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | while( my ( $k, $v ) = each %reg ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | { | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | map{ $_ =~ s/$k/$v/g }@file; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | else | ||||||||||||||||||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | $file[0] = "#!$perl$1" if $file[0] =~ /#![^#]*perl(.*$)/o; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | warn "$file\n"; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | untie @file; | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | sub insl | ||||||||||||||||||||||||||||||||||||||||||
| 54 | { | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | print '#' x 30, " check module ", '#' x 30, "\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insl: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | map{ | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | $_ =~ s/'//g; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if( system "$perl -e \"use $_\" >/dev/null 2>&1" ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | { | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | print "install $_\n"; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | mysystem( "$cpan install $_" ); | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | else { print "$_=> ok.\n"; } | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | print '-' x 74, "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 67 | }@_; | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if( $ENV{dan} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | { | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | mysystem "rsync -a dan/ dan.i/"; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | repl( 'dan.i' ); | |||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | mysystem "rsync -a dan.i/ '$mydan/dan/'"; | |||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | my %m; | |||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | tie my ( @file ), 'Tie::File', 'Makefile.PL'; | |||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | map{ $m{$1} = 1 if $_ =~ /\s+'?([:\w]+)'? => [\d\.]+/ }@file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | untie @file; | |||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | insl( keys %m ); | |||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if( $ENV{box} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | { | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | mysystem "rsync -a box/ box.i/"; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | mysystem "rsync -a dan/node/ box.i/node/"; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | map { mysystem "rsync -a dan/tools/$_ box.i/tools/" } qw(range mcmd mssh expect vssh go mrsync rsync alias unalias sync config whois gateway git ); | |||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my @sed = ( | |||||||||||||||||||||||||||||||||||||||||
| 95 | 'box.i/tools/vssh' => [ 'logname', 'id -un' ], | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 'box.i/tools/vssh' => [ 'MYDan::VSSH::Execute::dan=1', 'MYDan::VSSH::Execute::dan=0' ], | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 'box.i/tools/mrsync' => [ 'MYDan::Agent::Mrsync', 'MYDan::Util::Mrsync' ], | ||||||||||||||||||||||||||||||||||||||||||
| 98 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | while( my ( $f, $s ) = splice @sed, 0, 2 ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | { | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | tie my ( @file ), 'Tie::File', $f; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | map{ s/$s->[0]/$s->[1]/g }@file; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | untie @file; | |||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | repl( 'box.i' ); | |||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | mysystem "rsync -a box.i/ '$mydan/box/'"; | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | unless( $ENV{dan} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my %m; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | tie my ( @file ), 'Tie::File', 'Makefile.PL'; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | map{ $m{$1} = 1 if $_ =~ /\s+'?([:\w]+)'? => [\d\.]+,\s*#box/ }@file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | untie @file; | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | insl( keys %m ); | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | if( $ENV{dan} || $ENV{box} || $ENV{bin} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$ENV{"dan"} or $ENV{"box"} or $ENV{"bin"}
$ENV{"dan"} or $ENV{"box"}
MC/DC0%0/3
$ENV{"dan"} or $ENV{"box"} or $ENV{"bin"}
$ENV{"dan"}
$ENV{"box"}
$ENV{"bin"}
Truth table0%0/4
A or B or C
A= $ENV{"dan"}B= $ENV{"box"}C= $ENV{"bin"}
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | { | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | mysystem "rsync -a bin/ bin.i/"; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | repl( 'bin.i' ); | |||||||||||||||||||||||||||||||||||||||||
| 124 | mysystem( "ln -fsn mydan bin.i/$ENV{nickname}" ) | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if $ENV{nickname} && $ENV{nickname} =~ /^[a-z0-9]+$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ENV{"nickname"} and $ENV{"nickname"} =~ /^[a-z0-9]+$/
MC/DC0%0/2
$ENV{"nickname"} and $ENV{"nickname"} =~ /^[a-z0-9]+$/
$ENV{"nickname"}
$ENV{"nickname"} =~ /^[a-z0-9]+$/
Truth table0%0/3
A and B
A= $ENV{"nickname"}B= $ENV{"nickname"} =~ /^[a-z0-9]+$/
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | mysystem "rsync -a bin.i/ '$mydan/bin/'"; | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | if( $ENV{def} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | { | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | mysystem( "rsync -av def/ def.i/" ); | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | repl( 'def.i', MYDanROOT => $mydan ); | |||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | mysystem( "rsync -av def.i/ ../" ); | |||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||