line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::FTPTurboSync::FileObject; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
768876
|
use Exception::Class::Base; |
|
1
|
|
|
|
|
589374
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
533093
|
use Exception::Class::TryCatch; |
|
1
|
|
|
|
|
603204
|
|
|
1
|
|
|
|
|
61
|
|
5
|
|
|
|
|
|
|
# the exception is purposed to indicate the program encountered with a bug |
6
|
1
|
|
|
1
|
|
11
|
use Exception::Class('PrgBug'); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# base class for remote dirs and files and local dirs and files |
9
|
|
|
|
|
|
|
sub new { |
10
|
0
|
|
|
0
|
0
|
|
my ( $class, $path, $perms ) = @_; |
11
|
0
|
|
|
|
|
|
my $self = { _path => $path, _perms => $perms } ; |
12
|
0
|
|
|
|
|
|
bless $self, $class; |
13
|
0
|
|
|
|
|
|
return $self; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
# return string |
16
|
|
|
|
|
|
|
sub getPath { |
17
|
0
|
|
|
0
|
0
|
|
my ( $self ) = @_; |
18
|
0
|
|
|
|
|
|
return $self->{_path}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
sub setPath { |
21
|
0
|
|
|
0
|
0
|
|
my ( $self, $newPath ) = @_; |
22
|
0
|
|
|
|
|
|
$self->{_path} = $newPath; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
# return integer |
25
|
|
|
|
|
|
|
sub getPerms { |
26
|
0
|
|
|
0
|
0
|
|
my ( $self ) = @_; |
27
|
0
|
|
|
|
|
|
return $self->{_perms}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
sub setPerms { |
30
|
0
|
|
|
0
|
0
|
|
my ( $self, $newPerms ) = @_; |
31
|
0
|
|
|
|
|
|
$self->{_perms} = $newPerms; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
# return ( $remote, $local ) |
34
|
|
|
|
|
|
|
sub sortByLocation { |
35
|
0
|
|
|
0
|
0
|
|
my ($class, $x, $y ) = @_; |
36
|
0
|
0
|
|
|
|
|
if ( $x->isRemote() ){ |
37
|
0
|
0
|
|
|
|
|
if ( $y->isRemote() ){ |
38
|
0
|
|
|
|
|
|
PrgBug->throw ( "Both objects are remote" ); |
39
|
|
|
|
|
|
|
} |
40
|
0
|
|
|
|
|
|
return ($x,$y); |
41
|
|
|
|
|
|
|
} |
42
|
0
|
|
|
|
|
|
return ($y,$x); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
# return true if object is remote |
45
|
|
|
|
|
|
|
sub isRemote { |
46
|
0
|
|
|
0
|
0
|
|
return 0; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
# return true if object is remote and new |
49
|
|
|
|
|
|
|
sub isNew { |
50
|
0
|
|
|
0
|
0
|
|
my ( $self ) = @_; |
51
|
0
|
0
|
|
|
|
|
if ( exists ($self->{_new} ) ){ |
52
|
0
|
|
|
|
|
|
return $self->{_new}; |
53
|
|
|
|
|
|
|
} |
54
|
0
|
|
|
|
|
|
return 0; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
sub set { |
57
|
0
|
|
|
0
|
0
|
|
my ( $self, $other ) = @_; |
58
|
0
|
0
|
|
|
|
|
if ( $other->isRemote() ){ |
59
|
0
|
|
|
|
|
|
$other->set ( $self ); |
60
|
|
|
|
|
|
|
}else{ |
61
|
0
|
|
|
|
|
|
PrbBug->throw ( "Both objects are local" ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |