lib/Beekeeper/AnyEvent.pm

filter: Statementstmt 100% 35 / 35 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 93.7% 45 / 48 CC 1 SCAR 0.0
CC
1
Cov
95%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Beekeeper/JSONRPC/Response.pm ↑ Summary lib/Beekeeper.pm »
1 package Beekeeper::AnyEvent;
2  
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 11 our $VERSION = '0.10';
7  
8 11 ▶use AnyEvent;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 11 ▶use AnyEvent::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 USE_PERL_BACKEND: {
13  
14 # Prefer AnyEvent perl backend over default EV, as it is fast enough
15 # and it does not ignore exceptions thrown from within callbacks
16  
17 11 ▶ $ENV{'PERL_ANYEVENT_MODEL'} ||= 'Perl' unless $AnyEvent::MODEL;
Branch: 1 branch
BranchTrueFalseTotal
unless $AnyEvent::MODEL 11 0 11
Condition50%1/2
$ENV{"PERL_ANYEVENT_MODEL"} ||= "Perl"
l!l
011
MC/DC0%0/1
$ENV{"PERL_ANYEVENT_MODEL"} ||= "Perl"
$ENV{"PERL_ANYEVENT_MODEL"}
Truth table50%1/2
A
A= $ENV{"PERL_ANYEVENT_MODEL"}
Aresult
11
00
18 }
19  
20 UNTAINT_IP_ADDR: {
21  
22 11 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
23 11 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 # Addresses resolved by AnyEvent::DNS are tainted, causing an "Insecure
26 # dependency in connect" error when running with taint mode enabled.
27 # These addresses can be blindly untainted before being passed to parse_ipv4
28 # and parse_ipv6 because these functions validate addresses properly
29  
30 11 my $parse_ipv4 = \&{'AnyEvent::Socket::parse_ipv4'};
31 11 ▶ *{'AnyEvent::Socket::parse_ipv4'} = sub ($) {
Subroutine __ANON__: called CC=1 SCAR=0.0
32 19 ($_[0]) = $_[0] =~ m/(.*)/s; # untaint addr
33 19 $parse_ipv4->(@_);
34 11 };
35  
36 11 my $parse_ipv6 = \&{'AnyEvent::Socket::parse_ipv6'};
37 11 ▶ *{'AnyEvent::Socket::parse_ipv6'} = sub ($) {
Subroutine __ANON__: called CC=1 SCAR=0.0
38 38 ($_[0]) = $_[0] =~ m/(.*)/s; # untaint addr
39 38 $parse_ipv6->(@_);
40 11 };
41 }
42  
43 11 1;
44  
45 __END__
« lib/Beekeeper/JSONRPC/Response.pm ↑ Summary lib/Beekeeper.pm »