blib/lib/HTTP/Tiny/Paranoid.pm

filter: Statementstmt 93.9% 31 / 33 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 2 totaltotal 81.1% 43 / 53 CC 4 SCAR 7.6
CC
4
Cov
88%
__ANON__
4.2
blocked_hosts
2.0
BEGIN
1.0
CRAP 2.1
↑ Summary
1 package HTTP::Tiny::Paranoid;
2 3 $HTTP::Tiny::Paranoid::VERSION = '0.08';
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: A safer HTTP::Tiny
7  
8 3 ▶use HTTP::Tiny 0.070;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use parent 'HTTP::Tiny';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use Net::DNS::Paranoid;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use Class::Method::Modifiers;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 my $dns = Net::DNS::Paranoid->new;
14  
15 0 ▶sub blocked_hosts { shift; $dns->blocked_hosts(@_) }
Subroutine blocked_hosts: not called CC=1 SCAR=6.9
Pod undocumented
16 1 ▶sub whitelisted_hosts { shift; $dns->whitelisted_hosts(@_) }
Subroutine whitelisted_hosts: called CC=1 SCAR=0.0
Pod undocumented
17  
18 3 ▶around _open_handle => sub {
Subroutine __ANON__: called CC=4 SCAR=14.2
19 3 my $next = shift;
20 3 my $self = shift;
21  
22 3 my ($req, $scheme, $host, $port, $peer) = @_;
23  
24 3 ▶ my ($ips, $error) = $dns->resolve($peer || $host);
Condition33%1/3
$peer || $host
l!l&&r!l&&!r
300
MC/DC0%0/2
$peer || $host
$peer $host
Truth table33%1/3
A || B
A= $peerB= $host
ABresult
1X1
011
000
25 3 ▶ die "$host: $error\n" if defined $error;
Branch: 1 branch
BranchTrueFalseTotal
if defined $error 1 2 3
26 2 ▶ die "$host: no IP address found\n" unless @$ips;
Branch: 1 branch
BranchTrueFalseTotal
unless @$ips 0 2 2
27 2 $self->$next($req, $scheme, $host, $port, $ips->[0]);
28 3 };
29  
30 3 1;
31 __END__
↑ Summary