| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 44 | 3 | ▶ | return lschmod($mode,@_) if $how == $LS; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 54 | 0 | ▶ | return getlschmod($mode,@_) if $how == $LS; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | return wantarray ? (($mode) x @_) : $mode; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
Condition100%3/3
not defined $or and /[augo]/
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]/
| |||||||||||||||||||||||||||||
| 92 | 16 | ▶ | /a/ and $W |= 7, next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | 16 | ▶ | /u/ and $W |= 1, next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | 9 | ▶ | /g/ and $W |= 2, next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | 5 | ▶ | /o/ and $W |= 4, next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 36 | ▶ | if (/[-+=]/){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | 18 | ▶ | $W ||= 7; | ||||||||||||||||||||||||||
|
Condition100%2/2
$File::chmod::W ||= 7
MC/DC100%1/1
$File::chmod::W ||= 7
$File::chmod::W
Truth table100%2/2
A
A= $File::chmod::W
| |||||||||||||||||||||||||||||
| 100 | 18 | ▶ | $or = (/[=+]/ ? 1 : 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | 18 | ▶ | clear() if /=/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 18 | next; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 18 | ▶ | croak "Bad mode $this" if not defined $or; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | 18 | ▶ | croak "Unknown mode: $mode" if !/[ugorwxslt]/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 18 | ▶ | /u/ and $or ? u_or() : u_not(); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 109 | 18 | ▶ | /g/ and $or ? g_or() : g_not(); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 110 | 18 | ▶ | /o/ and $or ? o_or() : o_not(); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 111 | 18 | ▶ | /r/ and $or ? r_or() : r_not(); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 112 | 18 | ▶ | /w/ and $or ? w_or() : w_not(); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 113 | 18 | ▶ | /x/ and $or ? x_or() : x_not(); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 114 | 18 | ▶ | /s/ and $or ? s_or() : s_not(); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 115 | 18 | ▶ | /l/ and $or ? l_or() : l_not(); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 116 | 18 | ▶ | /t/ and $or ? t_or() : t_not(); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | 18 | ▶ | $VAL &= ~$MASK if $UMASK; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | 18 | push @return, $VAL; | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | 18 | ▶ | return wantarray ? @return : $return[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | my ($u,$g,$o) = ($mode =~ /^.(...)(...)(...)$/); | |||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 0 | for ($u){ | |||||||||||||||||||||||||||
| 142 | 0 | ▶ | $VAL |= 0400 if /r/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | $VAL |= 0200 if /w/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 0 | ▶ | $VAL |= 0100 if /[xs]/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 145 | 0 | ▶ | $VAL |= 04000 if /[sS]/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | for ($g){ | |||||||||||||||||||||||||||
| 149 | 0 | ▶ | $VAL |= 0040 if /r/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | 0 | ▶ | $VAL |= 0020 if /w/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 151 | 0 | ▶ | $VAL |= 0010 if /[xs]/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | 0 | ▶ | $VAL |= 02000 if /[sS]/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | for ($o){ | |||||||||||||||||||||||||||
| 156 | 0 | ▶ | $VAL |= 0004 if /r/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 0 | ▶ | $VAL |= 0002 if /w/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | 0 | ▶ | $VAL |= 0001 if /[xt]/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | 0 | ▶ | $VAL |= 01000 if /[Tt]/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 0 | ▶ | return wantarray ? (($VAL) x @_) : $VAL; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 169 | 36 | ▶ | return $SYM if $mode =~ /[augo=+,]/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 170 | 8 | ▶ | return $LS if $mode =~ /^.([r-][w-][xSs-]){2}[r-][w-][xTt-]$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 183 | 0 | ▶ | $W & 2 and $VAL &= 05707; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | $W & 4 and $VAL &= 07770; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 191 | 0 | ▶ | $W & 4 and ($VAL |= (($val & 0700)>>6)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 198 | 0 | ▶ | $W & 2 and $VAL &= ~(($val & 0700)>>3 | ($val & 04000)>>1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 0 | ▶ | $W & 4 and $VAL &= ~(($val & 0700)>>6); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 206 | 0 | ▶ | $W & 4 and $VAL |= ($val & 070)>>3; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 213 | 0 | ▶ | $W & 2 and $VAL &= ~(($val & 070) | ($val & 02000)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 0 | ▶ | $W & 4 and $VAL &= ~(($val & 070)>>3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 221 | 0 | ▶ | $W & 2 and $VAL |= (($val & 07)<<3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | $W & 2 and $VAL &= ~(($val & 07)<<3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 229 | 0 | ▶ | $W & 4 and $VAL &= ~($val & 07); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 235 | 4 | ▶ | $W & 2 and $VAL |= 0040; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | 4 | ▶ | $W & 4 and $VAL |= 0004; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 242 | 4 | ▶ | $W & 2 and $VAL &= ~0040; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 243 | 4 | ▶ | $W & 4 and $VAL &= ~0004; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 249 | 1 | ▶ | $W & 2 and $VAL |= 0020; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 250 | 1 | ▶ | $W & 4 and $VAL |= 0002; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 256 | 2 | ▶ | $W & 2 and $VAL &= ~0020; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | 2 | ▶ | $W & 4 and $VAL &= ~0002; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 263 | 1 | ▶ | $W & 1 and $VAL |= 0100; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 264 | 1 | ▶ | $W & 2 and $VAL |= 0010; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 265 | 1 | ▶ | $W & 4 and $VAL |= 0001; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 271 | 1 | ▶ | $W & 2 and $VAL &= ~0010; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 272 | 1 | ▶ | $W & 4 and $VAL &= ~0001; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 278 | 0 | ▶ | if (not $VAL & 00100){ $DEBUG and carp($ERROR{ENEXUID}), return } | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 279 | 0 | ▶ | if (not $VAL & 00010){ $DEBUG and carp($ERROR{ENEXGID}), return } | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 280 | 0 | ▶ | $W & 1 and $VAL |= 04000; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 281 | 0 | ▶ | $W & 2 and $VAL |= 02000; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 282 | 0 | ▶ | $W & 4 and $DEBUG and carp $ERROR{ENULSID}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$File::chmod::W & 4 and $File::chmod::DEBUG
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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 288 | 0 | ▶ | $W & 2 and $VAL &= ~02000; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 289 | 0 | ▶ | $W & 4 and $DEBUG and carp $ERROR{ENULSID}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$File::chmod::W & 4 and $File::chmod::DEBUG
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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 295 | 0 | ▶ | if ($VAL & 00010){ $DEBUG and carp ($ERROR{ENLOCEX}), return } | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
$File::chmod::W & 1 and $File::chmod::DEBUG
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
| |||||||||||||||||||||||||||||
| 307 | 3 | ▶ | $W & 2 and $DEBUG and carp $ERROR{ENULSBG}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$File::chmod::W & 2 and $File::chmod::DEBUG
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
| |||||||||||||||||||||||||||||
| 308 | 3 | ▶ | $W & 4 and $VAL |= 01000; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
$File::chmod::W & 1 and $File::chmod::DEBUG
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
| |||||||||||||||||||||||||||||
| 314 | 2 | ▶ | $W & 2 and $DEBUG and carp $ERROR{ENULSBG}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$File::chmod::W & 2 and $File::chmod::DEBUG
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
| |||||||||||||||||||||||||||||
| 315 | 2 | ▶ | $W & 4 and $VAL &= ~01000; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | 7 | 1; | |||||||||||||||||||||||||||
| 320 | # ABSTRACT: Implements symbolic and ls chmod modes | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | __END__ | ||||||||||||||||||||||||||||