Die/utime.pm

filter: Statementstmt 91.6% 11 / 12 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 90.0% 18 / 20 CC 4 SCAR 12.3
CC
4
Cov
89%
utime
4.0
BEGIN
1.0
CRAP 3.4
« Die.pm ↑ Summary Die/chmod.pm »
1 package IO::Die;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 #NOTE: This will only utime() one thing at a time. It refuses to support
6 #multiple utime() 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->utime() for @items;
10 #
11 3 ▶sub utime {
Subroutine utime: called CC=4 SCAR=14.0
12 3 my ( $NS, $atime, $mtime, $target, @too_many_args ) = @_;
13  
14 3 ▶ die "Only one utime() at a time!" if @too_many_args;
Branch: 1 branch
BranchTrueFalseTotal
if @too_many_args 1 2 3
15  
16 2 local ( $!, $^E );
17 2 ▶ my $ok = CORE::utime( $atime, $mtime, $target ) or do {
Branch: 1 branch
BranchTrueFalseTotal
my $ok = CORE::utime($atime, $mtime, $target) or do { if (__is_a_fh($target)) { $NS->__THROW("Utime", "atime", $atime, "mtime", $mtime, "path", $target); } ; $NS->__THROW("Utime", "atime", $atime, "mtime", $mtime) } 1 1 2
18 1 ▶ if ( __is_a_fh($target) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (__is_a_fh($target)) 0 1 1
19 0 $NS->__THROW( 'Utime', atime => $atime, mtime => $mtime, path => $target );
20 }
21  
22 1 $NS->__THROW( 'Utime', atime => $atime, mtime => $mtime );
23 };
24  
25 1 return $ok;
26 }
27  
28 1 1;
« Die.pm ↑ Summary Die/chmod.pm »