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