line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Die; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
145
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#NOTE: This will only chmod() one thing at a time. It refuses to support |
6
|
|
|
|
|
|
|
#multiple chmod() operations within the same call. This is in order to provide |
7
|
|
|
|
|
|
|
#reliable error reporting. |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
#You, of course, can still do: IO::Die->chmod() for @items; |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
sub chmod { |
12
|
5
|
|
|
5
|
1
|
1636
|
my ( $NS, $mode, $target, @too_many_args ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#This is here because it’s impossible to do reliable error-checking when |
15
|
|
|
|
|
|
|
#you operate on >1 filesystem node at once. |
16
|
5
|
100
|
|
|
|
22
|
die "Only one path at a time!" if @too_many_args; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#NOTE: This breaks chmod’s error reporting when a file handle is passed in. |
19
|
|
|
|
|
|
|
#cf. https://rt.perl.org/Ticket/Display.html?id=122703 |
20
|
4
|
|
|
|
|
20
|
local ( $!, $^E ); |
21
|
|
|
|
|
|
|
|
22
|
4
|
100
|
|
|
|
125
|
my $ok = CORE::chmod( $mode, $target ) or do { |
23
|
2
|
50
|
|
|
|
6
|
if ( __is_a_fh($target) ) { |
24
|
0
|
|
|
|
|
0
|
$NS->__THROW( 'Chmod', permissions => $mode ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
8
|
$NS->__THROW( 'Chmod', permissions => $mode, path => $target ); |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
11
|
return $ok; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |