NAME

Reflex::Role::UdpPeer - Turn an object into a UDP network peer.

VERSION

version 0.004

SYNOPSIS

{
	package Reflex::UdpPeer::Echo;
	use Moose;
	with 'Reflex::Role::UdpPeer';

	sub on_udppeer_datagram {
		my ($self, $args) = @_;
		my $data = $args->{datagram};

		if ($data =~ /^\s*shutdown\s*$/) {
			$self->destruct();
			return;
		}

		$self->send(
			datagram    => $data,
			remote_addr => $args->{remote_addr},
		);
	}

	sub on_udppeer_error {
		my ($self, $args) = @_;
		warn "$args->{op} error $args->{errnum}: $args->{errstr}";
		$self->destruct();
	}
}

DESCRIPTION

Reflex::Role::UdpPeer is an alternative to inheriting from Reflex::UdpPeer directly.

TODO - Complete the documentation.

GETTING HELP

"GETTING HELP" in Reflex

ACKNOWLEDGEMENTS

"ACKNOWLEDGEMENTS" in Reflex

SEE ALSO

Reflex and "SEE ALSO" in Reflex

BUGS

"BUGS" in Reflex

CORE AUTHORS

"CORE AUTHORS" in Reflex

OTHER CONTRIBUTORS

"OTHER CONTRIBUTORS" in Reflex

COPYRIGHT AND LICENSE

"COPYRIGHT AND LICENSE" in Reflex