AnyEvent-Connection

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    push_write
        See AE::Handle::push_write

    push_read
        See AE::Handle::push_read

    unshift_read
        See AE::Handle::unshift_read

    say Same as push_write + newline

    reply
        Same as push_write + newline

    For next methods there is a feature. Callback will be called in any way,
    either by successful processing or by error or object destruction

    recv($bytes, %args, cb => $cb->())
        Similar to

lib/AnyEvent/Connection.pm  view on Meta::CPAN


sub DESTROY {
	my $self = shift;
	warn "(".int($self).") Destroying AE::CNN" if $self->{debug};
	$self->disconnect;
	%$self = ();
}

BEGIN {
	no strict 'refs';
	for my $m (qw(push_write push_read unshift_read say reply recv command want_command)) {
		*$m = sub {
			my $self = shift;
			$self->{connected} or return $self->event( error => "Not connected for $m" );
			$self->{con}->$m(@_);
		};
	}
}

=head1 AUTHOR

lib/AnyEvent/Connection/Raw.pm  view on Meta::CPAN

		undef $cb;
	});
}

sub unshift_read {
	my $self = shift;
	$self->{h} or return;
	$self->{h}->unshift_read(@_);
}

sub say {
	my $self = shift;
	$self->{h} or return;
	for (@_) {
		if (!ref and utf8::is_utf8($_)) {
			$_ = $_;
			utf8::encode $_;
		}
	}
	$self->{h}->push_write("@_$self->{nl}");
	warn ">> @_  " if $self->{debug};



( run in 0.524 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )