line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Message::Passing::Output::Socket::UDP; |
2
|
1
|
|
|
1
|
|
407
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
3
|
1
|
|
|
1
|
|
727
|
use IO::Socket::INET; |
|
1
|
|
|
|
|
11966
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
461
|
use namespace::clean -except => 'meta'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with qw/ |
7
|
|
|
|
|
|
|
Message::Passing::Role::Output |
8
|
|
|
|
|
|
|
Message::Passing::Role::HasHostnameAndPort |
9
|
|
|
|
|
|
|
Message::Passing::Role::HasErrorChain |
10
|
|
|
|
|
|
|
/; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has '+port' => ( |
13
|
|
|
|
|
|
|
required => 1, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
0
|
|
|
sub _default_port { die "You must supply a port #" } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has handle => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
builder => '_build_handle', |
21
|
|
|
|
|
|
|
lazy => 1, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub BUILD { |
25
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
26
|
0
|
|
|
|
|
|
$self->handle; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _build_handle { |
30
|
0
|
|
|
0
|
|
|
my $self = shift; |
31
|
0
|
0
|
|
|
|
|
IO::Socket::INET->new( |
32
|
|
|
|
|
|
|
Proto => 'udp', |
33
|
|
|
|
|
|
|
PeerAddr => $self->hostname, |
34
|
|
|
|
|
|
|
PeerPort => $self->port, |
35
|
|
|
|
|
|
|
) or die "Could not create UDP socket: $!\n"; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub consume { |
39
|
0
|
|
|
0
|
1
|
|
my ($self, $msg) = @_; |
40
|
0
|
|
|
|
|
|
$self->handle->send($msg); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Message::Passing::Output::Socket::UDP |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Outputs messages to a UDP socket. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 METHODS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 consume |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Consumes a message by emitting it over UDP. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT AND LICENSE |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
See L. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |