line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Component::Resolver::Sidecar; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$POE::Component::Resolver::Sidecar::VERSION = '0.921'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
84
|
|
7
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
85
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
13
|
use Storable qw(nfreeze thaw); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
203
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
13
|
use Socket qw(getaddrinfo); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
227
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub main { |
14
|
0
|
|
|
0
|
1
|
|
my $buffer = ""; |
15
|
0
|
|
|
|
|
|
my $read_length; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
binmode(STDIN); |
18
|
0
|
|
|
|
|
|
binmode(STDOUT); |
19
|
0
|
|
|
|
|
|
select STDOUT; $| = 1; |
|
0
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
2
|
|
12
|
use bytes; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
while (1) { |
24
|
0
|
0
|
|
|
|
|
if (defined $read_length) { |
|
|
0
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
if (length($buffer) >= $read_length) { |
26
|
0
|
|
|
|
|
|
my $request = thaw(substr($buffer, 0, $read_length, "")); |
27
|
0
|
|
|
|
|
|
$read_length = undef; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my ($request_id, $host, $service, $hints) = @$request; |
30
|
0
|
|
|
|
|
|
my ($err, @addrs) = getaddrinfo($host, $service, $hints); |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $streamable = nfreeze( [ $request_id, $err, \@addrs ] ); |
33
|
0
|
|
|
|
|
|
my $stream = length($streamable) . chr(0) . $streamable; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $octets_wrote = syswrite(STDOUT, $stream); |
36
|
0
|
0
|
|
|
|
|
die $! unless $octets_wrote == length($stream); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
next; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
elsif ($buffer =~ s/^(\d+)\0//) { |
42
|
0
|
|
|
|
|
|
$read_length = $1; |
43
|
0
|
|
|
|
|
|
next; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $octets_read = sysread(STDIN, $buffer, 4096, length($buffer)); |
47
|
0
|
0
|
|
|
|
|
last unless $octets_read; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
exit 0; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |