Net-CDP

 view release on metacpan or  search on metacpan

lib/Net/CDP.pm  view on Meta::CPAN

	undef;
}

sub _v6_unpack {
	my $result = sprintf '%x:%x:%x:%x:%x:%x:%x:%x', unpack 'n8', shift;
	$result =~ s/:0(:0)+:/::/;
	$result =~ s/^0:/:/;
	$result;
}

sub _rethrow(&) {
	my $sub = shift;
	if (wantarray) {
		my @result = eval { &$sub };
		if ($@) {
			$@ =~ s/ at \S+ line \d+\.\n\z//;
			croak $@;
		}
		@result;
	} else {
		my $result = eval { &$sub };

lib/Net/CDP/Manager.pm  view on Meta::CPAN

If an error occurs on a hard port, this function croaks with an error message.

When an error is detected on a soft port, it is deactivated for up to 30
seconds. No errors are generated by this function in this case.

Note that if C<$timeout> is not specified and the callback function does
not modify its third argument, this function may never exit.

=cut

sub cdp_loop(&;$) {
	my $callback = shift;
	croak "Invalid callback"
		unless defined $callback && ref $callback eq 'CODE';
	my $remain = shift;
	
	_clear_error();
	
	my $count = 0;
	{ do {
		# All of this is so that cdp_recv will never block



( run in 0.288 second using v1.01-cache-2.11-cpan-49f99fa48dc )