FTPTurboSync/FileObject.pm

filter: Statementstmt 27.0% 10 / 37 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 3 / 12 Podpod 0.0% 0 / 9 totaltotal 19.7% 13 / 66 CC 5 SCAR 15.4
CC
5
Cov
22%
sortByLocation
12.0
isNew
6.0
set
6.0
CRAP 4.7
« FTPTurboSync/FileLeaf.pm ↑ Summary FTPTurboSync/FileNode.pm »
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
BranchTrueFalseTotal
if ($x->isRemote) 0 0 0
37 0 ▶ if ( $y->isRemote() ){
Branch: 1 branch
BranchTrueFalseTotal
if ($y->isRemote) 0 0 0
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
BranchTrueFalseTotal
if (exists $self->{"_new"}) 0 0 0
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
BranchTrueFalseTotal
if ($other->isRemote) { } 0 0 0
59 0 $other->set ( $self );
60 }else{
61 0 PrbBug->throw ( "Both objects are local" );
62 }
63 }
64  
65 1 1;
« FTPTurboSync/FileLeaf.pm ↑ Summary FTPTurboSync/FileNode.pm »