| 1 | package Net::FTPTurboSync::FileObject; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use Exception::Class::Base; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Exception::Class::TryCatch; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | # the exception is purposed to indicate the program encountered with a bug | ||||||||||
| 6 | 1 | ▶ | use Exception::Class('PrgBug'); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | # base class for remote dirs and files and local dirs and files | ||||||||||
| 9 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 10 | 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 | 0 | ▶ | sub getPath { | ||||||||
|
Subroutine
getPath: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 17 | 0 | my ( $self ) = @_; | |||||||||
| 18 | 0 | return $self->{_path}; | |||||||||
| 19 | } | ||||||||||
| 20 | 0 | ▶ | sub setPath { | ||||||||
|
Subroutine
setPath: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 21 | 0 | my ( $self, $newPath ) = @_; | |||||||||
| 22 | 0 | $self->{_path} = $newPath; | |||||||||
| 23 | } | ||||||||||
| 24 | # return integer | ||||||||||
| 25 | 0 | ▶ | sub getPerms { | ||||||||
|
Subroutine
getPerms: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 26 | 0 | my ( $self ) = @_; | |||||||||
| 27 | 0 | return $self->{_perms}; | |||||||||
| 28 | } | ||||||||||
| 29 | 0 | ▶ | sub setPerms { | ||||||||
|
Subroutine
setPerms: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 30 | 0 | my ( $self, $newPerms ) = @_; | |||||||||
| 31 | 0 | $self->{_perms} = $newPerms; | |||||||||
| 32 | } | ||||||||||
| 33 | # return ( $remote, $local ) | ||||||||||
| 34 | 0 | ▶ | sub sortByLocation { | ||||||||
|
Subroutine
sortByLocation: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 35 | 0 | my ($class, $x, $y ) = @_; | |||||||||
| 36 | 0 | ▶ | if ( $x->isRemote() ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | ▶ | if ( $y->isRemote() ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | 0 | ▶ | sub isRemote { | ||||||||
|
Subroutine
isRemote: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 46 | 0 | return 0; | |||||||||
| 47 | } | ||||||||||
| 48 | # return true if object is remote and new | ||||||||||
| 49 | 0 | ▶ | sub isNew { | ||||||||
|
Subroutine
isNew: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 50 | 0 | my ( $self ) = @_; | |||||||||
| 51 | 0 | ▶ | if ( exists ($self->{_new} ) ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 0 | return $self->{_new}; | |||||||||
| 53 | } | ||||||||||
| 54 | 0 | return 0; | |||||||||
| 55 | } | ||||||||||
| 56 | 0 | ▶ | sub set { | ||||||||
|
Subroutine
set: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 57 | 0 | my ( $self, $other ) = @_; | |||||||||
| 58 | 0 | ▶ | if ( $other->isRemote() ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | 0 | $other->set ( $self ); | |||||||||
| 60 | }else{ | ||||||||||
| 61 | 0 | PrbBug->throw ( "Both objects are local" ); | |||||||||
| 62 | } | ||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 1 | 1; | |||||||||