| 1 | package Feersum; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 374 | ▶ | use 5.014; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 374 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 374 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 374 | ▶ | use EV (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 374 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 374 | ▶ | use Socket (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 374 | our $VERSION = '1.509'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 374 | require Feersum::Connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 374 | require Feersum::Connection::Handle; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 374 | require XSLoader; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 374 | XSLoader::load('Feersum', $VERSION); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # dist-style string for --version; $VERSION is numified below | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 374 | our $VERSION_STRING = $VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # numify as per http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 374 | $VERSION = eval $VERSION; ## no critic (StringyEval, ConstantVersion) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 374 | our $INSTANCE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 374 | my %_SOCKETS; # inside-out storage for socket refs (keyed by Scalar::Util::refaddr) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # advertised port when the socket cannot report its own; underscore hides it from Pod::Coverage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 374 | ▶ | use constant _DEFAULT_HTTP_PORT => 80; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 374 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 374 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 374 | our @EXPORT_OK = qw(HEADER_NORM_SKIP HEADER_NORM_UPCASE HEADER_NORM_LOCASE HEADER_NORM_UPCASE_DASH HEADER_NORM_LOCASE_DASH); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 296 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=9.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | unless ($INSTANCE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=9.2
Pod
documented
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | $INSTANCE = __PACKAGE__->_xs_default_server(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | $SIG{PIPE} = 'IGNORE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | return $INSTANCE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 373 | *endjinn = *new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 455 | ▶ | sub new_instance { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_instance: called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_instance: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | $SIG{PIPE} = 'IGNORE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | return $class->_xs_new_server(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $addr = Scalar::Util::refaddr($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | delete $_SOCKETS{$addr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # XS DESTROY is renamed to _xs_destroy and called here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | $self->_xs_destroy(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # hold $sock against GC while accepting on it, once per socket (respawns re-register listeners) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 557 | ▶ | sub _hold_socket { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_hold_socket: called CC=5 SCAR=23.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | my ($addr, $sock) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_hold_socket: not called CC=5 SCAR=23.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | my $held = $_SOCKETS{$addr} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$_SOCKETS{$addr} ||= []
$_SOCKETS{$addr} ||= []
MC/DC100%1/1
$_SOCKETS{$addr} ||= []
$_SOCKETS{$addr}
MC/DC0%0/1
$_SOCKETS{$addr} ||= []
$_SOCKETS{$addr}
Truth table100%2/2
A
A= $_SOCKETS{$addr}
Truth table0%0/2
A
A= $_SOCKETS{$addr}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | for my $s (@$held) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | return if defined $s && "$s" eq "$sock"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
defined $s and "$s" eq "$sock"
defined $s and "$s" eq "$sock"
MC/DC0%0/2
defined $s and "$s" eq "$sock"
defined $s
"$s" eq "$sock"
MC/DC0%0/2
defined $s and "$s" eq "$sock"
defined $s
"$s" eq "$sock"
Truth table33%1/3
A and B
A= defined $sB= "$s" eq "$sock"
Truth table0%0/3
A and B
A= defined $sB= "$s" eq "$sock"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | push @$held, $sock; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 557 | ▶ | sub use_socket { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
use_socket: called CC=18 SCAR=45.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | my ($self, $sock) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
use_socket: not called CC=18 SCAR=45.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my $addr = Scalar::Util::refaddr($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my $fd = fileno $sock; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | Carp::croak "Invalid socket: fileno returned undef" unless defined $fd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | _hold_socket($addr, $sock); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | $self->accept_on_fd($fd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # Try socket methods first, fall back to getsockname() for raw sockets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | my ($host, $port) = ('localhost', _DEFAULT_HTTP_PORT); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if ($sock->can('sockhost')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | $host = eval { $sock->sockhost() } || 'localhost'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
eval {
do {
$sock->sockhost
}
} || 'localhost'
eval {
do {
$sock->sockhost
}
} || 'localhost'
MC/DC0%0/1
eval {
do {
$sock->sockhost
}
} || 'localhost'
eval {
do {
$sock->sockhost
}
}
MC/DC0%0/1
eval {
do {
$sock->sockhost
}
} || 'localhost'
eval {
do {
$sock->sockhost
}
}
Truth table50%1/2
A
A= eval {
do {
$sock->sockhost
}
}
Truth table0%0/2
A
A= eval {
do {
$sock->sockhost
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | $port = eval { $sock->sockport() } || _DEFAULT_HTTP_PORT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
eval {
do {
$sock->sockport
}
} || 80
eval {
do {
$sock->sockport
}
} || 80
MC/DC0%0/1
eval {
do {
$sock->sockport
}
} || 80
eval {
do {
$sock->sockport
}
}
MC/DC0%0/1
eval {
do {
$sock->sockport
}
} || 80
eval {
do {
$sock->sockport
}
}
Truth table50%1/2
A
A= eval {
do {
$sock->sockport
}
}
Truth table0%0/2
A
A= eval {
do {
$sock->sockport
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my $sockaddr = getsockname($sock); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | if ($sockaddr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my $family = eval { Socket::sockaddr_family($sockaddr) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | if (defined $family && $family == Socket::AF_INET()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
Condition33%2/6
defined $family and $family == 2
defined $family and $family == 2
MC/DC50%1/2
defined $family and $family == 2
defined $family
$family == 2
MC/DC0%0/2
defined $family and $family == 2
defined $family
$family == 2
Truth table66%2/3
A and B
A= defined $familyB= $family == 2
Truth table0%0/3
A and B
A= defined $familyB= $family == 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | (my $packed_port, my $packed_addr) = Socket::sockaddr_in($sockaddr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | $host = Socket::inet_ntoa($packed_addr) || 'localhost'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
Socket::inet_ntoa($packed_addr) || 'localhost'
Socket::inet_ntoa($packed_addr) || 'localhost'
MC/DC0%0/1
Socket::inet_ntoa($packed_addr) || 'localhost'
Socket::inet_ntoa($packed_addr)
MC/DC0%0/1
Socket::inet_ntoa($packed_addr) || 'localhost'
Socket::inet_ntoa($packed_addr)
Truth table50%1/2
A
A= Socket::inet_ntoa($packed_addr)
Truth table0%0/2
A
A= Socket::inet_ntoa($packed_addr)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # port 0 is valid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | $port = defined($packed_port) ? $packed_port : _DEFAULT_HTTP_PORT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | } elsif (defined $family && eval { Socket::AF_INET6() } && $family == Socket::AF_INET6()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%3/12
defined $family and eval {
do {
10
}
} and $family == 10
defined $family and eval {
do {
10
}
}
defined $family and eval {
do {
10
}
} and $family == 10
defined $family and eval {
do {
10
}
}
MC/DC33%1/3
defined $family and eval {
do {
10
}
} and $family == 10
defined $family
eval {
do {
10
}
}
$family == 10
MC/DC0%0/3
defined $family and eval {
do {
10
}
} and $family == 10
defined $family
eval {
do {
10
}
}
$family == 10
Truth table50%2/4
A and B and C
A= defined $familyB= eval {
do {
10
}
}C= $family == 10
Truth table0%0/4
A and B and C
A= defined $familyB= eval {
do {
10
}
}C= $family == 10
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | (my $packed_port, my $packed_addr) = Socket::sockaddr_in6($sockaddr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | $host = Socket::inet_ntop(Socket::AF_INET6(), $packed_addr) || 'localhost'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
Socket::inet_ntop(10, $packed_addr) || 'localhost'
Socket::inet_ntop(10, $packed_addr) || 'localhost'
MC/DC0%0/1
Socket::inet_ntop(10, $packed_addr) || 'localhost'
Socket::inet_ntop(10, $packed_addr)
MC/DC0%0/1
Socket::inet_ntop(10, $packed_addr) || 'localhost'
Socket::inet_ntop(10, $packed_addr)
Truth table50%1/2
A
A= Socket::inet_ntop(10, $packed_addr)
Truth table0%0/2
A
A= Socket::inet_ntop(10, $packed_addr)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | $port = defined($packed_port) ? $packed_port : _DEFAULT_HTTP_PORT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | } elsif (defined $family && eval { Socket::AF_UNIX() } && $family == Socket::AF_UNIX()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition16%2/12
defined $family and eval {
do {
1
}
} and $family == 1
defined $family and eval {
do {
1
}
}
defined $family and eval {
do {
1
}
} and $family == 1
defined $family and eval {
do {
1
}
}
MC/DC0%0/3
defined $family and eval {
do {
1
}
} and $family == 1
defined $family
eval {
do {
1
}
}
$family == 1
MC/DC0%0/3
defined $family and eval {
do {
1
}
} and $family == 1
defined $family
eval {
do {
1
}
}
$family == 1
Truth table25%1/4
A and B and C
A= defined $familyB= eval {
do {
1
}
}C= $family == 1
Truth table0%0/4
A and B and C
A= defined $familyB= eval {
do {
1
}
}C= $family == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # matches what the C side reports for REMOTE_ADDR on AF_UNIX | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ($host, $port) = ('unix', 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | $self->set_server_name_and_port($host,$port); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # called from XS under G_EVAL when a header carries magic or overload, since FETCH or "" may die | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 6 | ▶ | sub _flatten_headers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flatten_headers: called CC=3 SCAR=15.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | my ($headers) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flatten_headers: not called CC=3 SCAR=15.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | for my $i (0 .. $#{$headers}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my $v = $headers->[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | push @out, defined($v) ? "$v" : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | return \@out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # called from XS under G_EVAL when the body carries magic, since a tied FETCH may die | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 43 | ▶ | sub _flatten_body { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flatten_body: called CC=3 SCAR=14.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | my ($body) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flatten_body: not called CC=3 SCAR=14.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | for my $e (@{$body}) { # copying fires a tied element's FETCH | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if (ref($e) eq 'SCALAR') { # ...and \$tied needs one level more | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my $copy = ${$e}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | push @out, \$copy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | else { push @out, $e } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | return \@out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # called from XS under G_EVAL with the error in $_[0]; a throw here is swallowed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 1 | ▶ | sub DIED { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DIED: called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # not carp: the caller is XS, and carp appends "at ... line N" regardless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | warn "DIED: $_[0]"; ## no critic (ErrorHandling::RequireCarping) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DIED: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 373 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||