lib/SMB/Tree.pm

filter: Statementstmt 33.3% 13 / 39 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 17 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 25.0% 4 / 16 Podpod 8.3% 1 / 12 totaltotal 18.3% 18 / 98 SCAR 40.6
CC
10
Cov
22%
new
56.0
is_local
6.0
is_remote
6.0
CRAP 58.1
« lib/SMB/v2/Command/Negotiate.pm ↑ Summary lib/SMB/v2/Command/Create.pm »
1 # SMB-Perl library, Copyright (C) 2014 Mikhael Goikhman, migo@cpan.org
2 #
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15  
16 package SMB::Tree;
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use parent 'SMB';
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 ▶use SMB::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 sub new ($$$%) {
26 0 ▶ my $class = shift;
Subroutine new: not called CC=7 SCAR=40.3
Pod documented
27 0 ▶ my $share = shift || die "No share in constructor";
Condition0%0/2
shift() || die('No share in constructor')
l!l
00
MC/DC0%0/1
shift() || die('No share in constructor')
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
28 0 ▶ my $id = shift || die "No tree id in constructor";
Condition0%0/2
shift() || die('No tree id in constructor')
l!l
00
MC/DC0%0/1
shift() || die('No tree id in constructor')
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
29 0 my %options = @_;
30  
31 0 ▶ $options{addr} //= undef; # remote
Condition0%0/2
$options{"addr"} //= undef
l!l
00
MC/DC0%0/1
$options{"addr"} //= undef
$options{"addr"}
Truth table0%0/2
A
A= $options{"addr"}
Aresult
11
00
32 0 ▶ $options{root} //= undef; # local
Condition0%0/2
$options{"root"} //= undef
l!l
00
MC/DC0%0/1
$options{"root"} //= undef
$options{"root"}
Truth table0%0/2
A
A= $options{"root"}
Aresult
11
00
33  
34 0 my $self = $class->SUPER::new(
35 %options,
36 share => $share,
37 id => $id,
38 );
39  
40 0 ▶ die "Neither 'root' for local tree nor 'addr' for remote tree in constructor"
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_local or $self->is_remote 0 0 0
Condition0%0/3
$self->is_local or $self->is_remote
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->is_local or $self->is_remote
$self->is_local $self->is_remote
Truth table0%0/3
A or B
A= $self->is_localB= $self->is_remote
ABresult
1X1
011
000
41 unless $self->is_local || $self->is_remote;
42  
43 0 return $self;
44 }
45  
46 sub is_ipc ($) {
47 0 ▶ my $self = shift;
Subroutine is_ipc: not called CC=1 SCAR=6.9
Pod undocumented
48  
49 0 return $self->share eq 'IPC$';
50 }
51  
52 sub is_local ($) {
53 0 ▶ my $self = shift;
Subroutine is_local: not called CC=2 SCAR=17.9
Pod undocumented
54  
55 0 ▶ return $self->root || $self->is_ipc;
Condition0%0/3
$self->root || $self->is_ipc
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->root || $self->is_ipc
$self->root $self->is_ipc
Truth table0%0/3
A || B
A= $self->rootB= $self->is_ipc
ABresult
1X1
011
000
56 }
57  
58 sub is_remote ($) {
59 0 ▶ my $self = shift;
Subroutine is_remote: not called CC=2 SCAR=17.9
Pod undocumented
60  
61 0 ▶ return $self->addr && $self->client;
Condition0%0/3
$self->addr && $self->client
!ll&&!rl&&r
000
MC/DC0%0/2
$self->addr && $self->client
$self->addr $self->client
Truth table0%0/3
A && B
A= $self->addrB= $self->client
ABresult
0X0
100
111
62 }
63  
64 sub perform_remote_command ($$@) {
65 0 ▶ my $self = shift;
Subroutine perform_remote_command: not called CC=2 SCAR=17.9
Pod undocumented
66 0 my $command = shift;
67  
68 0 ▶ die unless $self->is_remote;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_remote 0 0 0
69  
70 0 $self->client->perform_tree_command($self, $command, @_);
71 }
72  
73 0 ▶sub chdir { shift()->perform_remote_command('chdir', @_); }
Subroutine chdir: not called CC=1 SCAR=6.9
Pod undocumented
74 0 ▶sub find { shift()->perform_remote_command('find', @_); }
Subroutine find: not called CC=1 SCAR=6.9
Pod undocumented
75 0 ▶sub dnload { shift()->perform_remote_command('dnload', @_); }
Subroutine dnload: not called CC=1 SCAR=6.9
Pod undocumented
76 0 ▶sub upload { shift()->perform_remote_command('upload', @_); }
Subroutine upload: not called CC=1 SCAR=6.9
Pod undocumented
77 0 ▶sub copy { shift()->perform_remote_command('copy', @_); }
Subroutine copy: not called CC=1 SCAR=6.9
Pod undocumented
78 0 ▶sub rename { shift()->perform_remote_command('rename', @_); }
Subroutine rename: not called CC=1 SCAR=6.9
Pod undocumented
79 0 ▶sub remove { shift()->perform_remote_command('remove', @_); }
Subroutine remove: not called CC=1 SCAR=6.9
Pod undocumented
80  
81 1 1;
« lib/SMB/v2/Command/Negotiate.pm ↑ Summary lib/SMB/v2/Command/Create.pm »