blib/lib/File/Slurp/Remote/BrokenDNS.pm

filter: Statementstmt 66.6% 28 / 42 Branchbran 16.6% 2 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 59.0% 36 / 61 CC 6 SCAR 19.7
CC
6
Cov
56%
__ANON__
12.0
__ANON__
11.3
BEGIN
1.0
CRAP 7.2
« blib/lib/File/Slurp/Remote/SmartOpen.pm ↑ Summary blib/lib/File/Slurp/Remote/CanonicalHostnames.pm »
1  
2 package File::Slurp::Remote::BrokenDNS;
3  
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Tie::Function::Examples qw(%q_shell);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Sys::Hostname::FQDN qw(fqdn);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 require Exporter;
10  
11 3 our @ISA = qw(Exporter);
12 3 our @EXPORT_OK = qw($myfqdn %fqdnify);
13 3 our $VERSION = '0.48';
14  
15 3 our %cache;
16 3 our $myfqdn;
17 3 our %fqdnify;
18  
19 3 ▶if ($ENV{BROKEN_DNS_WORKAROUND}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{'BROKEN_DNS_WORKAROUND'}) { } 0 3 3
20 0 $myfqdn = `hostname`;
21 0 chomp($myfqdn);
22 tie %fqdnify, 'Tie::Function::Examples',
23 0 ▶ sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
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 ▶ return $host if $host =~ /^-/;
Branch: 1 branch
BranchTrueFalseTotal
if $host =~ /^-/ 0 0 0
27 0 my $hn = `ssh -o StrictHostKeyChecking=no -n $q_shell{$host} hostname`;
28 0 chomp($hn);
29 0 return $cache{$host} = $hn;
30 0 };
31 } else {
32 3 $myfqdn = fqdn();
33  
34 tie %fqdnify, 'Tie::Function::Examples',
35 8 ▶ sub {
Subroutine __ANON__: called CC=4 SCAR=24.2
36 8 my ($host) = @_;
37 8 ▶ return $cache{$host} if $cache{$host};
Branch: 1 branch
BranchTrueFalseTotal
if $File::Slurp::Remote::BrokenDNS::cache{$host} 8 0 8
38 0 my $iaddr = gethostbyname($host);
39 0 ▶ return $host unless defined $iaddr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $iaddr 0 0 0
40 0 my $name = gethostbyaddr($iaddr, AF_INET);
41 0 ▶ return $host unless defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
42 0 return $cache{$host} = $name;
43 3 };
44 }
45  
46 3 1;
47  
48 __END__
« blib/lib/File/Slurp/Remote/SmartOpen.pm ↑ Summary blib/lib/File/Slurp/Remote/CanonicalHostnames.pm »