blib/lib/File/chmod.pm

filter: Statementstmt 58.6% 102 / 174 Branchbran 37.1% 87 / 234 Conditioncond 56.5% 13 / 23 MC/DCmcdc 46.6% 7 / 15 Subroutinesub 54.5% 18 / 33 Podpod 25.0% 7 / 28 totaltotal 46.1% 234 / 507 CC 133 SCAR 41.7
CC
133
Cov
47%
getlschmod
342.0
s_or
132.0
getsymchmod
53.7
CRAP 64.8
↑ Summary
1 package File::chmod;
2 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 ▶use vars qw( $VAL $W $MODE );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 7 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 7 our $VERSION = '0.42'; # VERSION
10  
11 7 our @EXPORT = (qw( chmod getchmod )); ## no critic ( ProhibitAutomaticExportation )
12 7 our @EXPORT_OK = (qw( symchmod lschmod getsymchmod getlschmod getmod ));
13  
14 7 our $DEBUG = 1;
15 7 our $UMASK = 2;
16 7 our $MASK = umask;
17  
18  
19 7 my ($SYM,$LS) = (1,2);
20 7 my %ERROR = (
21 EDETMOD => "use of determine_mode is deprecated",
22 ENEXLOC => "cannot set group execute on locked file",
23 ENLOCEX => "cannot set file locking on group executable file",
24 ENSGLOC => "cannot set-gid on locked file",
25 ENLOCSG => "cannot set file locking on set-gid file",
26 ENEXUID => "execute bit must be on for set-uid",
27 ENEXGID => "execute bit must be on for set-gid",
28 ENULSID => "set-id has no effect for 'others'",
29 ENULSBG => "sticky bit has no effect for 'group'",
30 ENULSBU => "sticky bit has no effect for 'user'",
31 );
32  
33 34 ▶sub getmod {
Subroutine getmod: called CC=2 SCAR=6.9
Pod documented
34 34 my @return = map { (stat)[2] & 07777 } @_;
35 34 ▶ return wantarray ? @return : $return[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 16 18 34
36 }
37  
38  
39 21 ▶sub chmod (@) { ## no critic ( Subroutines::ProhibitBuiltinHomonyms Subroutines::ProhibitSubroutinePrototypes )
Subroutine chmod: called CC=3 SCAR=11.0
Pod documented
40 21 my $mode = shift;
41 21 my $how = mode($mode);
42  
43 21 ▶ return symchmod($mode,@_) if $how == $SYM;
Branch: 1 branch
BranchTrueFalseTotal
if $how == $SYM 18 3 21
44 3 ▶ return lschmod($mode,@_) if $how == $LS;
Branch: 1 branch
BranchTrueFalseTotal
if $how == $LS 0 3 3
45 3 return CORE::chmod($mode,@_);
46 }
47  
48  
49 0 ▶sub getchmod {
Subroutine getchmod: not called CC=4 SCAR=30.0
Pod documented
50 0 my $mode = shift;
51 0 my $how = mode($mode);
52  
53 0 ▶ return getsymchmod($mode,@_) if $how == $SYM;
Branch: 1 branch
BranchTrueFalseTotal
if $how == $SYM 0 0 0
54 0 ▶ return getlschmod($mode,@_) if $how == $LS;
Branch: 1 branch
BranchTrueFalseTotal
if $how == $LS 0 0 0
55 0 ▶ return wantarray ? (($mode) x @_) : $mode;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
56 }
57  
58  
59 18 ▶sub symchmod {
Subroutine symchmod: called CC=4 SCAR=14.1
Pod documented
60 18 my $mode = shift;
61  
62 18 ▶warnings::warnif 'deprecated', '$UMASK being true is deprecated'
Branch: 1 branch
BranchTrueFalseTotal
if $File::chmod::UMASK == 2 0 18 18
63 . ' it will be false by default in the future. This change'
64 . ' is being made because this not the behavior of the unix command'
65 . ' `chmod`. This warning can be disabled by putting explicitly'
66 . ' setting $File::chmod::UMASK to false (0) to act like system chmod,'
67 . ' or any non 2 true value see Github issue #5 '
68 if $UMASK == 2;
69  
70 18 my @return = getsymchmod($mode,@_);
71 18 my $ret = 0;
72 18 ▶ for (@_){ $ret++ if CORE::chmod(shift(@return),$_) }
Branch: 1 branch
BranchTrueFalseTotal
if CORE::chmod shift @return, $_ 18 0 18
73 18 return $ret;
74 }
75  
76  
77 18 ▶sub getsymchmod {
Subroutine getsymchmod: called CC=37 SCAR=39.8
Pod documented
78 18 my $mode = shift;
79 18 my @return;
80  
81 18 ▶ croak "symchmod received non-symbolic mode: $mode" if mode($mode) != $SYM;
Branch: 1 branch
BranchTrueFalseTotal
if mode($mode) != $SYM 0 18 18
82  
83 18 for (@_){
84 18 local $VAL = getmod($_);
85  
86 18 for my $this (split /,/, $mode){
87 18 local $W = 0;
88 18 my $or;
89  
90 18 for (split //, $this){
91 52 ▶ if (not defined $or and /[augo]/){
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $or and /[augo]/) 16 36 52
Condition100%3/3
not defined $or and /[augo]/
!ll&&!rl&&r
181816
MC/DC100%2/2
not defined $or and /[augo]/
not defined $or /[augo]/
Truth table100%3/3
not(A) and B
A= not defined $orB= /[augo]/
ABresult
0X0
100
111
92 16 ▶ /a/ and $W |= 7, next;
Branch: 1 branch
BranchTrueFalseTotal
/a/ and $File::chmod::W |= 7, next 0 16 16
93 16 ▶ /u/ and $W |= 1, next;
Branch: 1 branch
BranchTrueFalseTotal
/u/ and $File::chmod::W |= 1, next 7 9 16
94 9 ▶ /g/ and $W |= 2, next;
Branch: 1 branch
BranchTrueFalseTotal
/g/ and $File::chmod::W |= 2, next 4 5 9
95 5 ▶ /o/ and $W |= 4, next;
Branch: 1 branch
BranchTrueFalseTotal
/o/ and $File::chmod::W |= 4, next 5 0 5
96 }
97  
98 36 ▶ if (/[-+=]/){
Branch: 1 branch
BranchTrueFalseTotal
if (/[-+=]/) 18 18 36
99 18 ▶ $W ||= 7;
Condition100%2/2
$File::chmod::W ||= 7
l!l
108
MC/DC100%1/1
$File::chmod::W ||= 7
$File::chmod::W
Truth table100%2/2
A
A= $File::chmod::W
Aresult
11
00
100 18 ▶ $or = (/[=+]/ ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
/[=+]/ ? : 9 9 18
101 18 ▶ clear() if /=/;
Branch: 1 branch
BranchTrueFalseTotal
if /=/ 0 18 18
102 18 next;
103 }
104  
105 18 ▶ croak "Bad mode $this" if not defined $or;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $or 0 18 18
106 18 ▶ croak "Unknown mode: $mode" if !/[ugorwxslt]/;
Branch: 1 branch
BranchTrueFalseTotal
unless /[ugorwxslt]/ 0 18 18
107  
108 18 ▶ /u/ and $or ? u_or() : u_not();
Branch: 2 branches
BranchTrueFalseTotal
/u/ and $or ? u_or() : u_not() 0 18 18
$or ? : 0 0 0
109 18 ▶ /g/ and $or ? g_or() : g_not();
Branch: 2 branches
BranchTrueFalseTotal
/g/ and $or ? g_or() : g_not() 0 18 18
$or ? : 0 0 0
110 18 ▶ /o/ and $or ? o_or() : o_not();
Branch: 2 branches
BranchTrueFalseTotal
/o/ and $or ? o_or() : o_not() 0 18 18
$or ? : 0 0 0
111 18 ▶ /r/ and $or ? r_or() : r_not();
Branch: 2 branches
BranchTrueFalseTotal
/r/ and $or ? r_or() : r_not() 8 10 18
$or ? : 4 4 8
112 18 ▶ /w/ and $or ? w_or() : w_not();
Branch: 2 branches
BranchTrueFalseTotal
/w/ and $or ? w_or() : w_not() 3 15 18
$or ? : 1 2 3
113 18 ▶ /x/ and $or ? x_or() : x_not();
Branch: 2 branches
BranchTrueFalseTotal
/x/ and $or ? x_or() : x_not() 2 16 18
$or ? : 1 1 2
114 18 ▶ /s/ and $or ? s_or() : s_not();
Branch: 2 branches
BranchTrueFalseTotal
/s/ and $or ? s_or() : s_not() 0 18 18
$or ? : 0 0 0
115 18 ▶ /l/ and $or ? l_or() : l_not();
Branch: 2 branches
BranchTrueFalseTotal
/l/ and $or ? l_or() : l_not() 0 18 18
$or ? : 0 0 0
116 18 ▶ /t/ and $or ? t_or() : t_not();
Branch: 2 branches
BranchTrueFalseTotal
/t/ and $or ? t_or() : t_not() 5 13 18
$or ? : 3 2 5
117 }
118 }
119 18 ▶ $VAL &= ~$MASK if $UMASK;
Branch: 1 branch
BranchTrueFalseTotal
if $File::chmod::UMASK 0 18 18
120 18 push @return, $VAL;
121 }
122 18 ▶ return wantarray ? @return : $return[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 18 0 18
123 }
124  
125  
126 0 ▶sub lschmod {
Subroutine lschmod: not called CC=1 SCAR=6.9
Pod documented
127 0 my $mode = shift;
128  
129 0 return CORE::chmod(getlschmod($mode,@_),@_);
130 }
131  
132  
133 0 ▶sub getlschmod {
Subroutine getlschmod: not called CC=18 SCAR=58.3
Pod documented
134 0 my $mode = shift;
135 0 my $VAL = 0;
136  
137 0 ▶ croak "lschmod received non-ls mode: $mode" if mode($mode) != $LS;
Branch: 1 branch
BranchTrueFalseTotal
if mode($mode) != $LS 0 0 0
138  
139 0 my ($u,$g,$o) = ($mode =~ /^.(...)(...)(...)$/);
140  
141 0 for ($u){
142 0 ▶ $VAL |= 0400 if /r/;
Branch: 1 branch
BranchTrueFalseTotal
if /r/ 0 0 0
143 0 ▶ $VAL |= 0200 if /w/;
Branch: 1 branch
BranchTrueFalseTotal
if /w/ 0 0 0
144 0 ▶ $VAL |= 0100 if /[xs]/;
Branch: 1 branch
BranchTrueFalseTotal
if /[xs]/ 0 0 0
145 0 ▶ $VAL |= 04000 if /[sS]/;
Branch: 1 branch
BranchTrueFalseTotal
if /[sS]/ 0 0 0
146 }
147  
148 0 for ($g){
149 0 ▶ $VAL |= 0040 if /r/;
Branch: 1 branch
BranchTrueFalseTotal
if /r/ 0 0 0
150 0 ▶ $VAL |= 0020 if /w/;
Branch: 1 branch
BranchTrueFalseTotal
if /w/ 0 0 0
151 0 ▶ $VAL |= 0010 if /[xs]/;
Branch: 1 branch
BranchTrueFalseTotal
if /[xs]/ 0 0 0
152 0 ▶ $VAL |= 02000 if /[sS]/;
Branch: 1 branch
BranchTrueFalseTotal
if /[sS]/ 0 0 0
153 }
154  
155 0 for ($o){
156 0 ▶ $VAL |= 0004 if /r/;
Branch: 1 branch
BranchTrueFalseTotal
if /r/ 0 0 0
157 0 ▶ $VAL |= 0002 if /w/;
Branch: 1 branch
BranchTrueFalseTotal
if /w/ 0 0 0
158 0 ▶ $VAL |= 0001 if /[xt]/;
Branch: 1 branch
BranchTrueFalseTotal
if /[xt]/ 0 0 0
159 0 ▶ $VAL |= 01000 if /[Tt]/;
Branch: 1 branch
BranchTrueFalseTotal
if /[Tt]/ 0 0 0
160 }
161  
162 0 ▶ return wantarray ? (($VAL) x @_) : $VAL;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
163 }
164  
165  
166 39 ▶sub mode {
Subroutine mode: called CC=4 SCAR=13.9
Pod undocumented
167 39 my $mode = shift;
168 39 ▶ return 0 if $mode !~ /\D/;
Branch: 1 branch
BranchTrueFalseTotal
unless $mode =~ /\D/ 3 36 39
169 36 ▶ return $SYM if $mode =~ /[augo=+,]/;
Branch: 1 branch
BranchTrueFalseTotal
if $mode =~ /[augo=+,]/ 28 8 36
170 8 ▶ return $LS if $mode =~ /^.([r-][w-][xSs-]){2}[r-][w-][xTt-]$/;
Branch: 1 branch
BranchTrueFalseTotal
if $mode =~ /^.([r-][w-][xSs-]){2}[r-][w-][xTt-]$/ 0 8 8
171 8 return $SYM;
172 }
173  
174  
175 0 ▶sub determine_mode {
Subroutine determine_mode: not called CC=1 SCAR=6.9
Pod undocumented
176 0 carp $ERROR{EDECMOD};
177 0 mode(@_);
178 }
179  
180  
181 0 ▶sub clear {
Subroutine clear: not called CC=4 SCAR=30.0
Pod undocumented
182 0 ▶ $W & 1 and $VAL &= 02077;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL &= 1087 0 0 0
183 0 ▶ $W & 2 and $VAL &= 05707;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL &= 3015 0 0 0
184 0 ▶ $W & 4 and $VAL &= 07770;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL &= 4088 0 0 0
185 }
186  
187  
188 0 ▶sub u_or {
Subroutine u_or: not called CC=3 SCAR=24.8
Pod undocumented
189 0 my $val = $VAL;
190 0 ▶ $W & 2 and ($VAL |= (($val & 0700)>>3 | ($val & 04000)>>1));
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL |= ($val & 448) >> 3 | ($val & 2048) >> 1 0 0 0
191 0 ▶ $W & 4 and ($VAL |= (($val & 0700)>>6));
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL |= ($val & 448) >> 6 0 0 0
192 }
193  
194  
195 0 ▶sub u_not {
Subroutine u_not: not called CC=4 SCAR=30.0
Pod undocumented
196 0 my $val = $VAL;
197 0 ▶ $W & 1 and $VAL &= ~(($val & 0700) | ($val & 05000));
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL &= ~($val & 448 | $val & 2560) 0 0 0
198 0 ▶ $W & 2 and $VAL &= ~(($val & 0700)>>3 | ($val & 04000)>>1);
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL &= ~(($val & 448) >> 3 | ($val & 2048) >> 1) 0 0 0
199 0 ▶ $W & 4 and $VAL &= ~(($val & 0700)>>6);
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL &= ~(($val & 448) >> 6) 0 0 0
200 }
201  
202  
203 0 ▶sub g_or {
Subroutine g_or: not called CC=3 SCAR=24.8
Pod undocumented
204 0 my $val = $VAL;
205 0 ▶ $W & 1 and $VAL |= (($val & 070)<<3 | ($val & 02000)<<1);
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL |= ($val & 56) << 3 | ($val & 1024) << 1 0 0 0
206 0 ▶ $W & 4 and $VAL |= ($val & 070)>>3;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL |= ($val & 56) >> 3 0 0 0
207 }
208  
209  
210 0 ▶sub g_not {
Subroutine g_not: not called CC=4 SCAR=30.0
Pod undocumented
211 0 my $val = $VAL;
212 0 ▶ $W & 1 and $VAL &= ~(($val & 070)<<3 | ($val & 02000)<<1);
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL &= ~(($val & 56) << 3 | ($val & 1024) << 1) 0 0 0
213 0 ▶ $W & 2 and $VAL &= ~(($val & 070) | ($val & 02000));
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL &= ~($val & 56 | $val & 1024) 0 0 0
214 0 ▶ $W & 4 and $VAL &= ~(($val & 070)>>3);
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL &= ~(($val & 56) >> 3) 0 0 0
215 }
216  
217  
218 0 ▶sub o_or {
Subroutine o_or: not called CC=3 SCAR=24.8
Pod undocumented
219 0 my $val = $VAL;
220 0 ▶ $W & 1 and $VAL |= (($val & 07)<<6);
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL |= ($val & 7) << 6 0 0 0
221 0 ▶ $W & 2 and $VAL |= (($val & 07)<<3);
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL |= ($val & 7) << 3 0 0 0
222 }
223  
224  
225 0 ▶sub o_not {
Subroutine o_not: not called CC=4 SCAR=30.0
Pod undocumented
226 0 my $val = $VAL;
227 0 ▶ $W & 1 and $VAL &= ~(($val & 07)<<6);
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL &= ~(($val & 7) << 6) 0 0 0
228 0 ▶ $W & 2 and $VAL &= ~(($val & 07)<<3);
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL &= ~(($val & 7) << 3) 0 0 0
229 0 ▶ $W & 4 and $VAL &= ~($val & 07);
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL &= ~($val & 7) 0 0 0
230 }
231  
232  
233 4 ▶sub r_or {
Subroutine r_or: called CC=4 SCAR=13.9
Pod undocumented
234 4 ▶ $W & 1 and $VAL |= 0400;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL |= 256 4 0 4
235 4 ▶ $W & 2 and $VAL |= 0040;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL |= 32 3 1 4
236 4 ▶ $W & 4 and $VAL |= 0004;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL |= 4 2 2 4
237 }
238  
239  
240 4 ▶sub r_not {
Subroutine r_not: called CC=4 SCAR=13.9
Pod undocumented
241 4 ▶ $W & 1 and $VAL &= ~0400;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL &= '18446744073709551359' 4 0 4
242 4 ▶ $W & 2 and $VAL &= ~0040;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL &= '18446744073709551583' 3 1 4
243 4 ▶ $W & 4 and $VAL &= ~0004;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL &= '18446744073709551611' 2 2 4
244 }
245  
246  
247 1 ▶sub w_or {
Subroutine w_or: called CC=4 SCAR=15.2
Pod undocumented
248 1 ▶ $W & 1 and $VAL |= 0200;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL |= 128 1 0 1
249 1 ▶ $W & 2 and $VAL |= 0020;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL |= 16 1 0 1
250 1 ▶ $W & 4 and $VAL |= 0002;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL |= 2 1 0 1
251 }
252  
253  
254 2 ▶sub w_not {
Subroutine w_not: called CC=4 SCAR=13.9
Pod undocumented
255 2 ▶ $W & 1 and $VAL &= ~0200;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL &= '18446744073709551487' 1 1 2
256 2 ▶ $W & 2 and $VAL &= ~0020;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL &= '18446744073709551599' 1 1 2
257 2 ▶ $W & 4 and $VAL &= ~0002;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL &= '18446744073709551613' 2 0 2
258 }
259  
260  
261 1 ▶sub x_or {
Subroutine x_or: called CC=6 SCAR=22.7
Pod undocumented
262 0 ▶ if ($VAL & 02000){ $DEBUG and carp($ERROR{ENEXLOC}), return }
Branch: 2 branches
BranchTrueFalseTotal
if ($File::chmod::VAL & 1024) 0 1 1
$File::chmod::DEBUG and carp($ERROR{"ENEXLOC"}), return 0 0 0
263 1 ▶ $W & 1 and $VAL |= 0100;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL |= 64 1 0 1
264 1 ▶ $W & 2 and $VAL |= 0010;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL |= 8 1 0 1
265 1 ▶ $W & 4 and $VAL |= 0001;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL |= 1 1 0 1
266 }
267  
268  
269 1 ▶sub x_not {
Subroutine x_not: called CC=4 SCAR=15.2
Pod undocumented
270 1 ▶ $W & 1 and $VAL &= ~0100;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL &= '18446744073709551551' 1 0 1
271 1 ▶ $W & 2 and $VAL &= ~0010;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL &= '18446744073709551607' 1 0 1
272 1 ▶ $W & 4 and $VAL &= ~0001;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL &= '18446744073709551614' 1 0 1
273 }
274  
275  
276 0 ▶sub s_or {
Subroutine s_or: not called CC=11 SCAR=48.8
Pod undocumented
277 0 ▶ if ($VAL & 02000){ $DEBUG and carp($ERROR{ENSGLOC}), return }
Branch: 2 branches
BranchTrueFalseTotal
if ($File::chmod::VAL & 1024) 0 0 0
$File::chmod::DEBUG and carp($ERROR{"ENSGLOC"}), return 0 0 0
278 0 ▶ if (not $VAL & 00100){ $DEBUG and carp($ERROR{ENEXUID}), return }
Branch: 2 branches
BranchTrueFalseTotal
unless ($File::chmod::VAL & 64) 0 0 0
$File::chmod::DEBUG and carp($ERROR{"ENEXUID"}), return 0 0 0
279 0 ▶ if (not $VAL & 00010){ $DEBUG and carp($ERROR{ENEXGID}), return }
Branch: 2 branches
BranchTrueFalseTotal
unless ($File::chmod::VAL & 8) 0 0 0
$File::chmod::DEBUG and carp($ERROR{"ENEXGID"}), return 0 0 0
280 0 ▶ $W & 1 and $VAL |= 04000;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL |= 2048 0 0 0
281 0 ▶ $W & 2 and $VAL |= 02000;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL |= 1024 0 0 0
282 0 ▶ $W & 4 and $DEBUG and carp $ERROR{ENULSID};
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::DEBUG and carp($ERROR{"ENULSID"}) 0 0 0
Condition0%0/3
$File::chmod::W & 4 and $File::chmod::DEBUG
!ll&&!rl&&r
000
MC/DC0%0/2
$File::chmod::W & 4 and $File::chmod::DEBUG
$File::chmod::W & 4 $File::chmod::DEBUG
Truth table0%0/3
A and B
A= $File::chmod::W & 4B= $File::chmod::DEBUG
ABresult
0X0
100
111
283 }
284  
285  
286 0 ▶sub s_not {
Subroutine s_not: not called CC=5 SCAR=34.0
Pod undocumented
287 0 ▶ $W & 1 and $VAL &= ~04000;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::VAL &= '18446744073709549567' 0 0 0
288 0 ▶ $W & 2 and $VAL &= ~02000;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::VAL &= '18446744073709550591' 0 0 0
289 0 ▶ $W & 4 and $DEBUG and carp $ERROR{ENULSID};
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::DEBUG and carp($ERROR{"ENULSID"}) 0 0 0
Condition0%0/3
$File::chmod::W & 4 and $File::chmod::DEBUG
!ll&&!rl&&r
000
MC/DC0%0/2
$File::chmod::W & 4 and $File::chmod::DEBUG
$File::chmod::W & 4 $File::chmod::DEBUG
Truth table0%0/3
A and B
A= $File::chmod::W & 4B= $File::chmod::DEBUG
ABresult
0X0
100
111
290 }
291  
292  
293 0 ▶sub l_or {
Subroutine l_or: not called CC=5 SCAR=34.0
Pod undocumented
294 0 ▶ if ($VAL & 02010){ $DEBUG and carp ($ERROR{ENLOCSG}), return }
Branch: 2 branches
BranchTrueFalseTotal
if ($File::chmod::VAL & 1032) 0 0 0
$File::chmod::DEBUG and carp($ERROR{"ENLOCSG"}), return 0 0 0
295 0 ▶ if ($VAL & 00010){ $DEBUG and carp ($ERROR{ENLOCEX}), return }
Branch: 2 branches
BranchTrueFalseTotal
if ($File::chmod::VAL & 8) 0 0 0
$File::chmod::DEBUG and carp($ERROR{"ENLOCEX"}), return 0 0 0
296 0 $VAL |= 02000;
297 }
298  
299  
300 0 ▶sub l_not {
Subroutine l_not: not called CC=2 SCAR=17.9
Pod undocumented
301 0 ▶ $VAL &= ~02000 if not $VAL & 00010;
Branch: 1 branch
BranchTrueFalseTotal
if not $File::chmod::VAL & 8 0 0 0
302 }
303  
304  
305 3 ▶sub t_or {
Subroutine t_or: called CC=6 SCAR=18.1
Pod undocumented
306 3 ▶ $W & 1 and $DEBUG and carp $ERROR{ENULSBU};
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::DEBUG and carp($ERROR{"ENULSBU"}) 2 1 3
Condition66%2/3
$File::chmod::W & 1 and $File::chmod::DEBUG
!ll&&!rl&&r
102
MC/DC50%1/2
$File::chmod::W & 1 and $File::chmod::DEBUG
$File::chmod::W & 1 $File::chmod::DEBUG
Truth table66%2/3
A and B
A= $File::chmod::W & 1B= $File::chmod::DEBUG
ABresult
0X0
100
111
307 3 ▶ $W & 2 and $DEBUG and carp $ERROR{ENULSBG};
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::DEBUG and carp($ERROR{"ENULSBG"}) 1 2 3
Condition66%2/3
$File::chmod::W & 2 and $File::chmod::DEBUG
!ll&&!rl&&r
201
MC/DC50%1/2
$File::chmod::W & 2 and $File::chmod::DEBUG
$File::chmod::W & 2 $File::chmod::DEBUG
Truth table66%2/3
A and B
A= $File::chmod::W & 2B= $File::chmod::DEBUG
ABresult
0X0
100
111
308 3 ▶ $W & 4 and $VAL |= 01000;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL |= 512 2 1 3
309 }
310  
311  
312 2 ▶sub t_not {
Subroutine t_not: called CC=6 SCAR=18.4
Pod undocumented
313 2 ▶ $W & 1 and $DEBUG and carp $ERROR{ENULSBU};
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 1 and $File::chmod::DEBUG and carp($ERROR{"ENULSBU"}) 1 1 2
Condition66%2/3
$File::chmod::W & 1 and $File::chmod::DEBUG
!ll&&!rl&&r
101
MC/DC50%1/2
$File::chmod::W & 1 and $File::chmod::DEBUG
$File::chmod::W & 1 $File::chmod::DEBUG
Truth table66%2/3
A and B
A= $File::chmod::W & 1B= $File::chmod::DEBUG
ABresult
0X0
100
111
314 2 ▶ $W & 2 and $DEBUG and carp $ERROR{ENULSBG};
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 2 and $File::chmod::DEBUG and carp($ERROR{"ENULSBG"}) 1 1 2
Condition66%2/3
$File::chmod::W & 2 and $File::chmod::DEBUG
!ll&&!rl&&r
101
MC/DC50%1/2
$File::chmod::W & 2 and $File::chmod::DEBUG
$File::chmod::W & 2 $File::chmod::DEBUG
Truth table66%2/3
A and B
A= $File::chmod::W & 2B= $File::chmod::DEBUG
ABresult
0X0
100
111
315 2 ▶ $W & 4 and $VAL &= ~01000;
Branch: 1 branch
BranchTrueFalseTotal
$File::chmod::W & 4 and $File::chmod::VAL &= '18446744073709551103' 2 0 2
316 }
317  
318  
319 7 1;
320 # ABSTRACT: Implements symbolic and ls chmod modes
321  
322 __END__
↑ Summary