line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::FTPTurboSync::MixRemote; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use Exception::Class::Base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
5
|
use Exception::Class::TryCatch; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
50
|
|
5
|
|
|
|
|
|
|
# something wrong with server or netlink |
6
|
1
|
|
|
1
|
|
5
|
use Exception::Class ('NetWorkEx'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
0
|
|
|
0
|
0
|
|
sub isRemote { return 1; } |
9
|
|
|
|
|
|
|
# delete a file or a dir from remote host and local db |
10
|
|
|
|
|
|
|
sub delete { |
11
|
0
|
|
|
0
|
0
|
|
my ( $self ) = @_; |
12
|
0
|
|
|
|
|
|
my $path = $self->getPath(); |
13
|
0
|
|
|
|
|
|
my $ftp = $self->{ftp}; |
14
|
0
|
0
|
|
|
|
|
if ( ! $self->deleteRemoteObjAndCheck( $path, $ftp ) ){ |
15
|
0
|
|
|
|
|
|
NetWorkEx->throw( "Cannot to remote file '" |
16
|
|
|
|
|
|
|
. $self->getPath() . "'" ); |
17
|
|
|
|
|
|
|
} |
18
|
0
|
|
|
|
|
|
$self->{dbh}->deleteFile ( $path ); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# remote file doesn't exist yet. |
22
|
|
|
|
|
|
|
sub newFileObject { |
23
|
0
|
|
|
0
|
0
|
|
my ( $class, $ftp, $dbh, $path ) = @_ ; |
24
|
0
|
|
|
|
|
|
my $self = $class->load ( $ftp, |
25
|
|
|
|
|
|
|
$dbh, |
26
|
|
|
|
|
|
|
{ size => 0, perms => 0, |
27
|
|
|
|
|
|
|
date => 0, fullname => $path } |
28
|
|
|
|
|
|
|
); |
29
|
0
|
|
|
|
|
|
$self->{_new} = 1; |
30
|
0
|
|
|
|
|
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
# load from db |
33
|
|
|
|
|
|
|
sub load { |
34
|
0
|
|
|
0
|
0
|
|
my ( $class, $ftp, $dbh, $info ) = @_ ; |
35
|
0
|
|
|
|
|
|
my $self = $class->instantiateObject ( $info->{fullname}, $info ); |
36
|
0
|
|
|
|
|
|
$self->{ftp} = $ftp; |
37
|
0
|
|
|
|
|
|
$self->{dbh} = $dbh; |
38
|
0
|
|
|
|
|
|
$self->{_new} = 0; |
39
|
0
|
|
|
|
|
|
return $self; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |