| 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
| |||||||||||
| 15 | |||||||||||
| 16 | 2 | local ( $!, $^E ); | |||||||||
| 17 | 2 | ▶ | my $ok = CORE::utime( $atime, $mtime, $target ) or do { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 1 | ▶ | if ( __is_a_fh($target) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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; | |||||||||