line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Child::Link::IPC::Socket; |
2
|
9
|
|
|
9
|
|
57
|
use strict; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
351
|
|
3
|
9
|
|
|
9
|
|
45
|
use warnings; |
|
9
|
|
|
|
|
9
|
|
|
9
|
|
|
|
|
276
|
|
4
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
45
|
use Child::Util; |
|
9
|
|
|
|
|
9
|
|
|
9
|
|
|
|
|
447
|
|
6
|
9
|
|
|
9
|
|
42
|
use Carp 'croak'; |
|
9
|
|
|
|
|
12
|
|
|
9
|
|
|
|
|
405
|
|
7
|
9
|
|
|
9
|
|
45
|
use Scalar::Util 'blessed'; |
|
9
|
|
|
|
|
9
|
|
|
9
|
|
|
|
|
747
|
|
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
|
48
|
use base 'Child::Link::IPC'; |
|
9
|
|
|
|
|
12
|
|
|
9
|
|
|
|
|
7866
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
add_accessors qw/socket_file connected/; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
0
|
0
|
sub post_init {} |
14
|
|
|
|
|
|
|
|
15
|
30
|
|
|
30
|
1
|
27958
|
sub read_handle { shift->_handle } |
16
|
31
|
|
|
31
|
1
|
5070361
|
sub write_handle { shift->_handle } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _handle { |
19
|
61
|
|
|
61
|
|
134
|
my $self = shift; |
20
|
61
|
50
|
|
|
|
322
|
croak "Not connected (" . blessed($self) . ':' . $self->pid . ")" |
21
|
|
|
|
|
|
|
unless $self->connected; |
22
|
61
|
|
|
|
|
911
|
return $self->ipc; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub init { |
26
|
22
|
|
|
22
|
1
|
2431
|
my $self = shift; |
27
|
22
|
|
|
|
|
195
|
my ( $file ) = @_; |
28
|
|
|
|
|
|
|
|
29
|
22
|
50
|
|
|
|
1724
|
$file = $self->_generate_socket_file |
30
|
|
|
|
|
|
|
if $file =~ m/^\d+$/; |
31
|
|
|
|
|
|
|
|
32
|
22
|
|
|
|
|
282
|
$self->_socket_file( $file ); |
33
|
|
|
|
|
|
|
|
34
|
22
|
|
|
|
|
716
|
$self->post_init( @_ ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _generate_socket_file { |
38
|
22
|
|
|
22
|
|
129
|
my $self = shift; |
39
|
22
|
|
|
|
|
1224
|
require File::Spec; |
40
|
22
|
|
|
|
|
5904
|
my $dir = File::Spec->tmpdir(); |
41
|
22
|
|
|
|
|
995
|
my $pid = $self->socket_pid; |
42
|
22
|
|
|
|
|
516
|
my $name = "$dir/Child-Socket.$pid"; |
43
|
22
|
|
|
|
|
313
|
$name =~ s|/+|/|g; |
44
|
22
|
|
|
|
|
67
|
return $name; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub disconnect { |
48
|
4
|
|
|
4
|
0
|
1492
|
my $self = shift; |
49
|
4
|
50
|
|
|
|
77
|
return unless $self->connected; |
50
|
4
|
|
|
|
|
163
|
my $handle = $self->ipc; |
51
|
4
|
|
|
|
|
158
|
close( $handle ); |
52
|
4
|
|
|
|
|
28
|
$self->_connected( undef ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Child::Link::IPC::Socket - Base object for socket based child links. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 SEE ALSO |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
L |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AUTHORS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Chad Granum L |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 COPYRIGHT |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Copyright (C) 2010 Chad Granum |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Child is free software; Standard perl licence. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Child is distributed in the hope that it will be useful, but WITHOUT |
76
|
|
|
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
77
|
|
|
|
|
|
|
FOR A PARTICULAR PURPOSE. See the license for more details. |