File/Slurp/Remote/BrokenDNS.pm

filter: Statementstmt 63.4% 26 / 41 Branchbran 10.0% 1 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod n/a totaltotal 55.1% 32 / 58 CC 5 SCAR 21.8
CC
5
Cov
53%
__ANON__
20.0
__ANON__
6.0
BEGIN
1.0
CRAP 8.8
« File/Slurp/Remote/SmartOpen.pm ↑ Summary File/Slurp/Remote.pm »
1  
2 package File::Slurp::Remote::BrokenDNS;
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Tie::Function::Examples;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Sys::Hostname::FQDN qw(fqdn);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 require Exporter;
10  
11 1 our @ISA = qw(Exporter);
12 1 our @EXPORT_OK = qw($myfqdn %fqdnify);
13 1 our $VERSION = 0.47;
14  
15 1 our %cache;
16 1 our $myfqdn;
17 1 our %fqdnify;
18  
19 1 ▶if ($ENV{BROKEN_DNS_WORKAROUND}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{'BROKEN_DNS_WORKAROUND'}) { } 0 1 1
20 0 $myfqdn = `hostname`;
21 0 chomp($myfqdn);
22 tie %fqdnify, 'Tie::Function::Examples',
23 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
24 0 my ($host) = @_;
25 0 ▶ return $cache{$host} if $cache{$host};
Branch: 1 branch
BranchTrueFalseTotal
if $File::Slurp::Remote::BrokenDNS::cache{$host} 0 0 0
26 0 my $hn = `ssh -o StrictHostKeyChecking=no $host -n hostname`;
27 0 chomp($hn);
28 0 return $cache{$host} = $hn;
29 0 };
30 } else {
31 1 $myfqdn = fqdn();
32  
33 tie %fqdnify, 'Tie::Function::Examples',
34 0 ▶ sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
35 0 my ($host) = @_;
36 0 ▶ return $cache{$host} if $cache{$host};
Branch: 1 branch
BranchTrueFalseTotal
if $File::Slurp::Remote::BrokenDNS::cache{$host} 0 0 0
37 0 my $iaddr = gethostbyname($host);
38 0 ▶ return $host unless defined $iaddr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $iaddr 0 0 0
39 0 my $name = gethostbyaddr($iaddr, AF_INET);
40 0 ▶ return $host unless defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
41 0 return $cache{$host} = $name;
42 1 };
43 }
44  
45 1 1;
46  
47 __END__
« File/Slurp/Remote/SmartOpen.pm ↑ Summary File/Slurp/Remote.pm »