File Coverage

blib/lib/LWP/Protocol/http/hosts.pm
Criterion Covered Total %
statement 18 18 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 26 27 96.3


line stmt bran cond sub pod time code
1             package LWP::Protocol::http::hosts;
2              
3 1     1   7 use strict;
  1         5  
  1         25  
4 1     1   5 use warnings;
  1         3  
  1         29  
5 1     1   5 use parent 'LWP::Protocol::http';
  1         2  
  1         17  
6 1     1   99 use LWP::UserAgent::DNS::Hosts;
  1         2  
  1         91  
7              
8             sub _extra_sock_opts {
9 4     4   24 my ($self, $host, $port) = @_;
10              
11 4         22 my @opts = $self->SUPER::_extra_sock_opts($host, $port);
12 4 100       38 if (my $peer_addr = LWP::UserAgent::DNS::Hosts->_registered_peer_addr($host)) {
13 3         13 push @opts, (PeerAddr => $peer_addr, Host => $host);
14             }
15              
16 4         45 return @opts;
17             }
18              
19 4     4 0 18586 sub socket_class { 'LWP::Protocol::http::Socket' }
20              
21             1;
22              
23             __END__