| 1 | package IO::Die; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 16 | ▶ | sub syswrite { | ||||||||||||||||||||||||||
|
Subroutine
syswrite: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||
| 6 | 16 | my ( $NS, $fh, @length_offset ) = ( shift, shift, @_[ 1 .. $#_ ] ); | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | #https://github.com/pjcj/Devel--Cover/issues/125 | ||||||||||||||||||||||||||||
| 9 | #my ( $NS, $fh, $buffer_sr, @length_offset ) = ( shift, shift, \shift, @_ ); | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 16 | my ( $length, $offset ) = @length_offset; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 16 | local ( $!, $^E ); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 16 | my $ret; | |||||||||||||||||||||||||||
| 16 | 16 | ▶ | if ( @length_offset > 1 ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 17 | 5 | $ret = CORE::syswrite( $fh, $_[0], $length, $offset ); | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | elsif (@length_offset) { | ||||||||||||||||||||||||||||
| 20 | 3 | $ret = CORE::syswrite( $fh, $_[0], $length ); | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | else { | ||||||||||||||||||||||||||||
| 23 | 8 | $ret = CORE::syswrite( $fh, $_[0] ); | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 16 | ▶ | if ( !defined $ret ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 6 | my $real_length = length $_[0]; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 6 | ▶ | if ($offset) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 3 | ▶ | if ( $offset > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 2 | $real_length -= $offset; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | else { | ||||||||||||||||||||||||||||
| 34 | 1 | $real_length = 0 - $offset; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 6 | ▶ | if ( defined $length && $length < $real_length ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $length and $length < $real_length
MC/DC100%2/2
defined $length and $length < $real_length
defined $length
$length < $real_length
Truth table100%3/3
A and B
A= defined $lengthB= $length < $real_length
| |||||||||||||||||||||||||||||
| 39 | 2 | $real_length = $length; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 6 | $NS->__THROW( 'Write', length => $real_length ); | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 10 | return $ret; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 4 | 1; | |||||||||||||||||||||||||||