line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package File::Slurp::Remote::BrokenDNS; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
6
|
1
|
|
|
1
|
|
558
|
use Tie::Function::Examples; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
7
|
1
|
|
|
1
|
|
1102
|
use Socket; |
|
1
|
|
|
|
|
71738
|
|
|
1
|
|
|
|
|
936
|
|
8
|
1
|
|
|
1
|
|
1248
|
use Sys::Hostname::FQDN qw(fqdn); |
|
1
|
|
|
|
|
1273
|
|
|
1
|
|
|
|
|
458
|
|
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw($myfqdn %fqdnify); |
13
|
|
|
|
|
|
|
our $VERSION = 0.2; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our %cache; |
16
|
|
|
|
|
|
|
our $myfqdn; |
17
|
|
|
|
|
|
|
our %fqdnify; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
if ($ENV{BROKEN_DNS_WORKAROUND}) { |
20
|
|
|
|
|
|
|
$myfqdn = `hostname`; |
21
|
|
|
|
|
|
|
chomp($myfqdn); |
22
|
|
|
|
|
|
|
tie %fqdnify, 'Tie::Function::Examples', |
23
|
|
|
|
|
|
|
sub { |
24
|
|
|
|
|
|
|
my ($host) = @_; |
25
|
|
|
|
|
|
|
return $cache{$host} if $cache{$host}; |
26
|
|
|
|
|
|
|
my $hn = `ssh -o StrictHostKeyChecking=no $host -n hostname`; |
27
|
|
|
|
|
|
|
chomp($hn); |
28
|
|
|
|
|
|
|
return $cache{$host} = $hn; |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
} else { |
31
|
|
|
|
|
|
|
$myfqdn = fqdn(); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
tie %fqdnify, 'Tie::Function::Examples', |
34
|
|
|
|
|
|
|
sub { |
35
|
|
|
|
|
|
|
my ($host) = @_; |
36
|
|
|
|
|
|
|
return $cache{$host} if $cache{$host}; |
37
|
|
|
|
|
|
|
my $iaddr = gethostbyname($host); |
38
|
|
|
|
|
|
|
return $host unless defined $iaddr; |
39
|
|
|
|
|
|
|
my $name = gethostbyaddr($iaddr, AF_INET); |
40
|
|
|
|
|
|
|
return $host unless defined $name; |
41
|
|
|
|
|
|
|
return $cache{$host} = $name; |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |