| 1 | #*** UploadMirror.pm ***# | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # Copyright (C) 2005 - 2008 by Torsten Knorr | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # create-soft@tiscali.de | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # All rights reserved! | ||||||||||||||||||||||||||||||||||||||||||
| 5 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | #------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 8 | package Net::UploadMirror::FileName; | ||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Storable; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | sub TIESCALAR{ my ($class, $obj) = @_; return bless(\$obj, $class || ref($class)); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TIESCALAR: called CC=2 SCAR=8.1
Condition33%1/3
$class || ref $class
MC/DC0%0/2
$class || ref $class
$class
ref $class
Truth table33%1/3
A || B
A= $classB= ref $class
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | sub STORE | ||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORE: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | ▶ | if(-f $_[1]) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | { | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ${$_[0]}->{_last_modified} = retrieve($_[1]); | |||||||||||||||||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||||||||||||||||
| 17 | else | ||||||||||||||||||||||||||||||||||||||||||
| 18 | { | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ${$_[0]}->{_last_modified} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | store(${$_[0]}->{_last_modified}, $_[1]); | |||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | warn("\nno information of the files last modified times\n"); | |||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 5 | ▶ | sub FETCH { return ${$_[0]}->{_filename}; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FETCH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 26 | package Net::UploadMirror; | ||||||||||||||||||||||||||||||||||||||||||
| 27 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | use Net::MirrorDir 0.19; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | use Storable; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | use vars '$AUTOLOAD'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | #------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | @Net::UploadMirror::ISA = qw(Net::MirrorDir); | |||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | $Net::UploadMirror::VERSION = '0.13'; | |||||||||||||||||||||||||||||||||||||||||
| 34 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 35 | sub _Init | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Init: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 2 | my ($self, %arg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | tie($self->{_filename}, 'Net::UploadMirror::FileName', $self); | |||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | ▶ | $self->{_filename} = $arg{filename} || 'lastmodified_local'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$arg{'filename'} || 'lastmodified_local'
MC/DC0%0/1
$arg{'filename'} || 'lastmodified_local'
$arg{'filename'}
Truth table50%1/2
A
A= $arg{'filename'}
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | ▶ | $self->{_delete} = $arg{delete} || 'disabled'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$arg{'delete'} || 'disabled'
MC/DC0%0/1
$arg{'delete'} || 'disabled'
$arg{'delete'}
Truth table50%1/2
A
A= $arg{'delete'}
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 44 | sub Upload | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Upload: not called CC=19 SCAR=59.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | return 0 unless($self->Connect()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my ($rh_lf, $rh_ld) = $self->ReadLocalDir(); | |||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if($self->{_debug}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | { | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | print("local files : $_\n") for(sort keys %$rh_lf); | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | print("local dirs : $_\n") for(sort keys %$rh_ld); | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my ($rh_rf, $rh_rd) = $self->ReadRemoteDir(); | |||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if($self->{_debug}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | { | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | print("remote files : $_\n") for(sort keys %$rh_rf); | |||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | print("remote dirs : $_\n") for(sort keys %$rh_rd); | |||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | my $ra_ldnir = $self->LocalNotInRemote($rh_ld, $rh_rd); | |||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if($self->{_debug}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | print("local directories not in remote : $_\n") for(@$ra_ldnir); | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $self->MakeDirs($ra_ldnir); | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my $ra_lfnir = $self->LocalNotInRemote($rh_lf, $rh_rf); | |||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | if($self->{_debug}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | print("local files not in remote: $_\n") for(@$ra_lfnir); | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $self->StoreFiles($ra_lfnir); | |||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if($self->{_delete} eq 'enable') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | { | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my $ra_rfnil = $self->RemoteNotInLocal($rh_lf, $rh_rf); | |||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | if($self->{_debug}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | { | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | print("remote files not in local : $_\n") for(@$ra_rfnil); | |||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $self->DeleteFiles($ra_rfnil); | |||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my $ra_rdnil = $self->RemoteNotInLocal($rh_ld, $rh_rd); | |||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | if($self->{_debug}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | { | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | print("remote directories not in local : $_\n") for(@$ra_rdnil); | |||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $self->RemoveDirs($ra_rdnil); | |||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | delete(@{$rh_lf}{@$ra_lfnir}); | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my $ra_mlf = $self->CheckIfModified($rh_lf); | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | if($self->{_debug}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | { | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | print("modified files : $_\n") for(@$ra_mlf); | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $self->StoreFiles($ra_mlf); | |||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $self->Quit(); | |||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 98 | sub CheckIfModified | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CheckIfModified: called CC=6 SCAR=27.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | my ($self, $rh_lf) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | my @mf; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | my $changed = undef; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 1 | for my $lf (keys(%$rh_lf)) | |||||||||||||||||||||||||||||||||||||||||
| 104 | { | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | next unless(-f $lf); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | if(defined($self->{_last_modified}{$lf})) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | next if($self->{_last_modified}{$lf} eq (stat($lf))[9]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | else | ||||||||||||||||||||||||||||||||||||||||||
| 111 | { | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $self->{_last_modified}{$lf} = (stat($lf))[9]; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $changed++; | |||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | push(@mf, $lf); | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | ▶ | store($self->{_last_modified}, $self->{_filename}) if($changed); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | return \@mf; | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 121 | sub UpdateLastModified | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
UpdateLastModified: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 2 | my ($self, $ra_lf) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 124 | 2 | for(@$ra_lf) | |||||||||||||||||||||||||||||||||||||||||
| 125 | { | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 3 | ▶ | next unless(-e $_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 3 | $self->{_last_modified}{$_} = (stat($_))[9]; | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 2 | store($self->{_last_modified}, $self->{_filename}); | |||||||||||||||||||||||||||||||||||||||||
| 130 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 133 | sub StoreFiles | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
StoreFiles: called CC=6 SCAR=32.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | my ($self, $ra_lf) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | ▶ | return 0 unless(@$ra_lf && $self->IsConnection()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@$ra_lf and $self->IsConnection
MC/DC0%0/2
@$ra_lf and $self->IsConnection
@$ra_lf
$self->IsConnection
Truth table33%1/3
A and B
A= @$ra_lfB= $self->IsConnection
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $rf; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | for my $lf (@$ra_lf) | |||||||||||||||||||||||||||||||||||||||||
| 139 | { | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | if(-f $lf) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | { | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $rf = $lf; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $rf =~ s!$self->{_regex_localdir}!$self->{_remotedir}!; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | $self->{_last_modified}{$lf} = (stat($lf))[9] if($self->{_connection}->put($lf, $rf)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | else | ||||||||||||||||||||||||||||||||||||||||||
| 147 | { | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | warn("error in StoreFiles() : $lf is not a local file\n"); | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | store($self->{_last_modified}, $self->{_filename}); | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 155 | sub MakeDirs | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
MakeDirs: called CC=5 SCAR=27.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 1 | my ($self, $ra_ld) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | ▶ | return 0 unless(@$ra_ld && $self->IsConnection()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@$ra_ld and $self->IsConnection
MC/DC0%0/2
@$ra_ld and $self->IsConnection
@$ra_ld
$self->IsConnection
Truth table33%1/3
A and B
A= @$ra_ldB= $self->IsConnection
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my $rd; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | for my $ld (@$ra_ld) | |||||||||||||||||||||||||||||||||||||||||
| 161 | { | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $rd = $ld; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | if(-d $ld) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | { | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $rd =~ s!$self->{_regex_localdir}!$self->{_remotedir}!; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $self->{_connection}->mkdir($rd, 1) ; | |||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | else | ||||||||||||||||||||||||||||||||||||||||||
| 169 | { | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | warn("error in MakeDirs() : $rd is not a local directory\n"); | |||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 176 | sub DeleteFiles | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DeleteFiles: called CC=6 SCAR=30.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | my ($self, $ra_rf) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 179 | return 0 unless( | ||||||||||||||||||||||||||||||||||||||||||
| 180 | @$ra_rf | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | ▶ | && ($self->{_delete} eq 'enable') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
@$ra_rf and $self->{"_delete"} eq "enable" and $self->IsConnection
@$ra_rf and $self->{"_delete"} eq "enable"
MC/DC0%0/3
@$ra_rf and $self->{"_delete"} eq "enable" and $self->IsConnection
@$ra_rf
$self->{"_delete"} eq "enable"
$self->IsConnection
Truth table25%1/4
A and B and C
A= @$ra_rfB= $self->{"_delete"} eq "enable"C= $self->IsConnection
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | && $self->IsConnection() | ||||||||||||||||||||||||||||||||||||||||||
| 183 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my $lf; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | for my $rf (@$ra_rf) | |||||||||||||||||||||||||||||||||||||||||
| 186 | { | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $lf = $rf; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $self->{_connection}->delete($rf); | |||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $lf =~ s!$self->{_regex_remotedir}!$self->{_localdir}!; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | delete($self->{_last_modified}{$lf}) if(defined($self->{_last_modified}{$lf})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | store($self->{_last_modified}, $self->{_filename}); | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 196 | sub RemoveDirs | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
RemoveDirs: called CC=5 SCAR=23.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 1 | my ($self, $ra_rd) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 199 | return 0 unless( | ||||||||||||||||||||||||||||||||||||||||||
| 200 | @$ra_rd | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | ▶ | && ($self->{_delete} eq 'enable') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
@$ra_rd and $self->{"_delete"} eq "enable" and $self->IsConnection
@$ra_rd and $self->{"_delete"} eq "enable"
MC/DC0%0/3
@$ra_rd and $self->{"_delete"} eq "enable" and $self->IsConnection
@$ra_rd
$self->{"_delete"} eq "enable"
$self->IsConnection
Truth table25%1/4
A and B and C
A= @$ra_rdB= $self->{"_delete"} eq "enable"C= $self->IsConnection
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | && $self->IsConnection() | ||||||||||||||||||||||||||||||||||||||||||
| 203 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $self->{_connection}->rmdir($_, 1) for(@$ra_rd); | |||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 208 | sub CleanUp | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CleanUp: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 1 | my ($self, $ra_exists) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 1 | my %h_temp = (); | |||||||||||||||||||||||||||||||||||||||||
| 212 | 1 | for my $key (@$ra_exists) | |||||||||||||||||||||||||||||||||||||||||
| 213 | { | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 3 | ▶ | if( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $self->{"_last_modified"}{$key} and $self->{"_last_modified"}{$key} =~ /^\d+$/
MC/DC100%2/2
defined $self->{"_last_modified"}{$key} and $self->{"_last_modified"}{$key} =~ /^\d+$/
defined $self->{"_last_modified"}{$key}
$self->{"_last_modified"}{$key} =~ /^\d+$/
Truth table100%3/3
A and B
A= defined $self->{"_last_modified"}{$key}B= $self->{"_last_modified"}{$key} =~ /^\d+$/
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | defined($self->{_last_modified}{$key}) | ||||||||||||||||||||||||||||||||||||||||||
| 216 | && | ||||||||||||||||||||||||||||||||||||||||||
| 217 | ($self->{_last_modified}{$key} =~ m/^\d+$/) | ||||||||||||||||||||||||||||||||||||||||||
| 218 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 219 | { | ||||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | $h_temp{$key} = delete($self->{_last_modified}{$key}); | |||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 1 | ▶ | if($self->{_debug}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | { | ||||||||||||||||||||||||||||||||||||||||||
| 225 | print( | ||||||||||||||||||||||||||||||||||||||||||
| 226 | "key: $_ value: " | ||||||||||||||||||||||||||||||||||||||||||
| 227 | . (defined($self->{_last_modified}{$_}) ? $self->{_last_modified}{$_} : 'undef') | ||||||||||||||||||||||||||||||||||||||||||
| 228 | . " removed\n") | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 1 | ▶ | for(keys(%{$self->{_last_modified}})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | %{$self->{_last_modified}} = %h_temp; | |||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | store($self->{_last_modified}, $self->{_filename}); | |||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 236 | sub LtoR | ||||||||||||||||||||||||||||||||||||||||||
| 237 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LtoR: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 1 | my ($self, $ra_lp) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 239 | 1 | my $ra_rp = []; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 1 | my $rp; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 1 | for(@$ra_lp) | |||||||||||||||||||||||||||||||||||||||||
| 242 | { | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 3 | $rp = $_; | |||||||||||||||||||||||||||||||||||||||||
| 244 | 3 | $rp =~ s!$self->{_regex_localdir}!$self->{_remotedir}!; | |||||||||||||||||||||||||||||||||||||||||
| 245 | 3 | push(@$ra_rp, $rp); | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | return $ra_rp; | |||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 250 | sub RtoL | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
RtoL: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 1 | my ($self, $ra_rp) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 1 | my $ra_lp = []; | |||||||||||||||||||||||||||||||||||||||||
| 254 | 1 | my $lp; | |||||||||||||||||||||||||||||||||||||||||
| 255 | 1 | for(@$ra_rp) | |||||||||||||||||||||||||||||||||||||||||
| 256 | { | ||||||||||||||||||||||||||||||||||||||||||
| 257 | 3 | $lp = $_; | |||||||||||||||||||||||||||||||||||||||||
| 258 | 3 | $lp =~ s!$self->{_regex_remotedir}!$self->{_localdir}!; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 3 | push(@$ra_lp, $lp); | |||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 1 | return $ra_lp; | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | #------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 265 | #------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 266 | __END__ | ||||||||||||||||||||||||||||||||||||||||||