line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Child::Link::IPC::Socket::Parent; |
2
|
9
|
|
|
9
|
|
45
|
use strict; |
|
9
|
|
|
|
|
12
|
|
|
9
|
|
|
|
|
618
|
|
3
|
9
|
|
|
9
|
|
45
|
use warnings; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
192
|
|
4
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
42
|
use Child::Util; |
|
9
|
|
|
|
|
42
|
|
|
9
|
|
|
|
|
681
|
|
6
|
9
|
|
|
9
|
|
42
|
use IO::Socket::UNIX; |
|
9
|
|
|
|
|
12
|
|
|
9
|
|
|
|
|
63
|
|
7
|
|
|
|
|
|
|
|
8
|
9
|
|
|
|
|
14301
|
use base qw/ |
9
|
|
|
|
|
|
|
Child::Link::IPC::Socket |
10
|
|
|
|
|
|
|
Child::Link::Parent |
11
|
9
|
|
|
9
|
|
6738
|
/; |
|
9
|
|
|
|
|
18
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
add_accessors qw/listener/; |
14
|
|
|
|
|
|
|
|
15
|
6
|
|
|
6
|
0
|
174
|
sub socket_pid { $$ }; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub post_init { |
18
|
6
|
|
|
6
|
0
|
51
|
my $self = shift; |
19
|
6
|
|
|
|
|
246
|
my $file = $self->socket_file; |
20
|
|
|
|
|
|
|
|
21
|
6
|
|
50
|
|
|
524
|
$self->_listener( |
22
|
|
|
|
|
|
|
IO::Socket::UNIX->new( |
23
|
|
|
|
|
|
|
Local => $file, |
24
|
|
|
|
|
|
|
Listen => 1, |
25
|
|
|
|
|
|
|
) || die ( "Could not create socket: $!" ) |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
6
|
|
|
|
|
6041
|
$self->connect( 5 ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub connect { |
32
|
8
|
|
|
8
|
0
|
45
|
my $self = shift; |
33
|
8
|
50
|
|
|
|
180
|
return if $self->connected; |
34
|
|
|
|
|
|
|
|
35
|
8
|
|
|
|
|
252
|
my ( $timeout ) = @_; |
36
|
8
|
|
|
|
|
40
|
my $client; |
37
|
|
|
|
|
|
|
|
38
|
8
|
|
33
|
|
|
104
|
while (!( $client = $self->_listener->accept ) && $timeout ) { |
39
|
0
|
|
|
|
|
0
|
$timeout--; |
40
|
0
|
|
|
|
|
0
|
sleep 1; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
8
|
50
|
|
|
|
4996873
|
return unless $client; |
44
|
|
|
|
|
|
|
|
45
|
8
|
|
|
|
|
161
|
$self->_ipc( $client ); |
46
|
8
|
|
|
|
|
398
|
$self->_connected( 1 ); |
47
|
8
|
|
|
|
|
175
|
$self->say( $$ ); |
48
|
|
|
|
|
|
|
|
49
|
8
|
|
|
|
|
2465
|
return $client; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 NAME |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Child::Link::IPC::Socket::Parent - Socket based link to parent process. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SEE ALSO |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 AUTHORS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Chad Granum L |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 COPYRIGHT |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Copyright (C) 2010 Chad Granum |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Child is free software; Standard perl licence. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Child is distributed in the hope that it will be useful, but WITHOUT |
73
|
|
|
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
74
|
|
|
|
|
|
|
FOR A PARTICULAR PURPOSE. See the license for more details. |