| 1 | package Net::FTPTurboSync::RemoteFile; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Net::FTPTurboSync::FileLeaf; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Net::FTPTurboSync::MixRemote; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use base qw(Net::FTPTurboSync::FileLeaf Net::FTPTurboSync::MixRemote); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 0 | ▶ | sub deleteRemoteObjAndCheck { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deleteRemoteObjAndCheck: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | my ( $self, $path, $ftp ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | return $ftp->delete ( $path ) or ! $ftp->size( $path ); | |||||||||||||||||||||||||||||||||||||||||
| 11 | } | ||||||||||||||||||||||||||||||||||||||||||
| 12 | #load info about remote file from db | ||||||||||||||||||||||||||||||||||||||||||
| 13 | # remote file already exists | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub instantiateObject { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
instantiateObject: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | my ( $class, $path, $info ) = @_ ; | |||||||||||||||||||||||||||||||||||||||||
| 16 | return $class->new ( $path, | ||||||||||||||||||||||||||||||||||||||||||
| 17 | $info->{perms}, | ||||||||||||||||||||||||||||||||||||||||||
| 18 | $info->{date}, | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | $info->{size} ); | |||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub writeToDb { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
writeToDb: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | my ( $self, $localf ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | if ( $self->isNew ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | $self->{_new}=0; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | $self->setPath ( $localf->getPath ); | |||||||||||||||||||||||||||||||||||||||||
| 27 | #insert db | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | $self->{dbh}->uploadFile ( $self->getPath, | |||||||||||||||||||||||||||||||||||||||||
| 29 | $self->getPerms, | ||||||||||||||||||||||||||||||||||||||||||
| 30 | $self->getModDate, | ||||||||||||||||||||||||||||||||||||||||||
| 31 | $self->getSize ); | ||||||||||||||||||||||||||||||||||||||||||
| 32 | }else { | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # update db | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | $self->{dbh}->reuploadFile ( $self->getPath, | |||||||||||||||||||||||||||||||||||||||||
| 35 | $self->getPerms, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | $self->getModDate, | ||||||||||||||||||||||||||||||||||||||||||
| 37 | $self->getSize ); | ||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub set { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | my ( $self, $localf ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | if ( $self->isNew | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->isNew or $self->getSize != $localf->getSize or $self->getModDate < $localf->getModDate
$self->isNew or $self->getSize != $localf->getSize
MC/DC0%0/3
$self->isNew or $self->getSize != $localf->getSize or $self->getModDate < $localf->getModDate
$self->isNew
$self->getSize != $localf->getSize
$self->getModDate < $localf->getModDate
Truth table0%0/4
A or B or C
A= $self->isNewB= $self->getSize != $localf->getSizeC= $self->getModDate < $localf->getModDate
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | or $self->getSize != $localf->getSize | ||||||||||||||||||||||||||||||||||||||||||
| 44 | or $self->getModDate < $localf->getModDate ) { | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my $p = $localf->getPath; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my $res = $self->{ftp}->put( $p, $p ); | |||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | if ( !defined( $res ) or ($res ne $p) ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $res or $res ne $p
MC/DC0%0/2
not defined $res or $res ne $p
not defined $res
$res ne $p
Truth table0%0/3
not(A) or B
A= not defined $resB= $res ne $p
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | NetWorkEx->throw ( "Could not put '" . $localf->getPath . "' file" ); | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $self->setSize ( $localf->getSize ); | |||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | $self->setModDate ( $localf->getModDate() ); | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | if ( $self->getPerms != $localf->getPerms ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $self->{ftp}->setPerms ( $localf->getPath, $localf->getPerms ); | |||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $self->setPerms ( $localf->getPerms ); | |||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | $self->writeToDb ( $localf ); | |||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||