blib/lib/HTTP/Tiny/Paranoid.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 2 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 40 CC 1 SCAR 6.9
CC
1
Cov
0%
blocked_hosts
2.0
whitelisted_hosts
2.0
BEGIN
2.0
CRAP 2.0
1 package HTTP::Tiny::Paranoid;
2 $HTTP::Tiny::Paranoid::VERSION = '0.03';
3 use strict;
4 use warnings;
5  
6 # ABSTRACT: A safer HTTP::Tiny
7  
8 use parent 'HTTP::Tiny';
9 use Net::DNS::Paranoid;
10 use Class::Method::Modifiers;
11  
12 my $dns = Net::DNS::Paranoid->new;
13  
14 sub blocked_hosts { shift; $dns->blocked_hosts(@_) }
15 sub whitelisted_hosts { shift; $dns->whitelisted_hosts(@_) }
16  
17 around _open_handle => sub {
18 my $next = shift;
19 my $self = shift;
20  
21 my ($req, $scheme, $host, $port) = @_;
22 my (undef, $error) = $dns->resolve($host);
23 die "$host: $error\n" if defined $error;
24  
25 $self->$next(@_);
26 };
27  
28 1;
29 __END__