Permalink
Browse files

remove poll_cb support

  • Loading branch information...
1 parent 0c70837 commit 34d82fbccf8c6a798c0b4465f232362e0af6af1d @miyagawa committed Feb 13, 2010
Showing with 0 additions and 65 deletions.
  1. +0 −32 lib/Twiggy.pm
  2. +0 −33 t/anyevent_extensions.t
View
@@ -544,37 +544,6 @@ sub new {
bless { handle => AnyEvent::Handle->new( fh => $socket ), exit_guard => $exit }, $class;
}
-sub poll_cb {
- my ( $self, $cb ) = @_;
-
- my $handle = $self->{handle};
-
- if ( $cb ) {
- # notifies that now is a good time to ->write
- $handle->on_drain(sub {
- do {
- if ( $self->{in_poll_cb} ) {
- $self->{poll_again}++;
- return;
- } else {
- local $self->{in_poll_cb} = 1;
- $cb->($self);
- }
- } while ( delete $self->{poll_again} );
- });
-
- # notifies of client close
- $handle->on_error(sub {
- my $err = $_[2];
- $handle->destroy;
- $cb->(undef, $err);
- });
- } else {
- $handle->on_drain;
- $handle->on_error;
- }
-}
-
sub write { $_[0]{handle}->push_write($_[1]) }
sub close {
@@ -585,7 +554,6 @@ sub close {
my $handle = delete $self->{handle};
if ($handle) {
- # kill poll_cb, but not $handle
$handle->on_drain;
$handle->on_error;
View
@@ -80,39 +80,6 @@ local @Plack::Test::Suite::TEST = (
}
},
],
- [
- 'coderef poll_cb',
- sub {
- my $cb = shift;
- my $res = $cb->(GET "http://127.0.0.1/?name=miyagawa");
- is $res->code, 200;
- is $res->header('content_type'), 'text/plain';
- is $res->content, 'Hello, name=miyagawa';
- },
- sub {
- my $env = shift;
-
- return sub {
- my ( $write, $sock ) = @_;
-
- my @queue = ( "Hello, ", $env->{QUERY_STRING} );
-
- my $w = $write->([
- 200,
- [ 'Content-Type' => 'text/plain' ],
- ]);
- $w->poll_cb(sub {
- my $writer = shift;
-
- if ( @queue ) {
- $writer->write(shift @queue);
- } else {
- $writer->close;
- }
- });
- };
- },
- ]
);
# prevent Lint middleware from being used

0 comments on commit 34d82fb

Please sign in to comment.