| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package POE::Component::Rendezvous::Publish; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
27898
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
40
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
49
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1110
|
use Net::Rendezvous::Publish; |
|
|
1
|
|
|
|
|
48471
|
|
|
|
1
|
|
|
|
|
10
|
|
|
9
|
1
|
|
|
1
|
|
8328
|
use POE; |
|
|
1
|
|
|
|
|
75156
|
|
|
|
1
|
|
|
|
|
7
|
|
|
10
|
1
|
|
|
1
|
|
128972
|
use POE::Session; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
4
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub create { |
|
14
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
15
|
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $publisher = Net::Rendezvous::Publish->new; |
|
17
|
0
|
0
|
|
|
|
|
return undef unless $publisher; |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $self = bless { publisher => $publisher, services => {} }, $class; |
|
20
|
0
|
|
|
|
|
|
$self->add_service( @_ ); |
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
POE::Session->create( |
|
23
|
|
|
|
|
|
|
object_states => [ |
|
24
|
|
|
|
|
|
|
$self => { |
|
25
|
|
|
|
|
|
|
_start => '_start_event', |
|
26
|
|
|
|
|
|
|
step => '_step_event', |
|
27
|
|
|
|
|
|
|
}, |
|
28
|
|
|
|
|
|
|
], |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _start_event { |
|
34
|
0
|
|
|
0
|
|
|
my $self = $_[OBJECT]; |
|
35
|
0
|
|
|
|
|
|
my $kern = $_[KERNEL]; |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
$kern->delay_set( step => 2 ); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _step_event { |
|
42
|
0
|
|
|
0
|
|
|
my $self = $_[OBJECT]; |
|
43
|
0
|
|
|
|
|
|
my $kern = $_[KERNEL]; |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$kern->delay_set( step => 2 ); |
|
46
|
0
|
|
|
|
|
|
$self->step(); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub step { |
|
51
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
52
|
0
|
|
|
|
|
|
my $pub = $self->{publisher}; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$pub->step( 0.01 ); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub add_service { |
|
59
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
60
|
0
|
|
|
|
|
|
my $pub = $self->{publisher}; |
|
61
|
0
|
|
|
|
|
|
my %args = @_; |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
return 0 unless $args{name}; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $service = $pub->publish( %args ); |
|
66
|
0
|
0
|
|
|
|
|
return 0 unless $service; |
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
$self->{$args{name}} = $service; |
|
69
|
0
|
|
|
|
|
|
return 1; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
|
74
|
|
|
|
|
|
|
__END__ |