Tatsumaki

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    Feel free to hack on it and ask me if you have questions or suggestions
    at IRC: #plack on irc.perl.org.

DESCRIPTION
    Tatsumaki is a toy port of Tornado for Perl using Plack (with
    non-blocking extensions) and AnyEvent.

    It allows you to write a web application that does a immediate response
    with template rendering, IO-bound delayed response (like fetching third
    party API or XML feeds), server push streaming and long-poll Comet in a
    clean unified API.

PSGI COMPATIBILITY
    When "asynchronous" is declared in your application, you need a PSGI
    server backend that supports "psgi.streaming" response style. If your
    application does server push with "stream_write", you need a server that
    supports "psgi.nonblocking" (and "psgi.streaming") as well.

    Currently Tatsumaki asynchronous application is supposed to run on
    Twiggy, Feersum, Corona and POE::Component::Server::PSGI.

    If "asynchronous" is not used, your application is supposed to run in
    any PSGI standard environments, including blocking multiprocess
    environments like Starman or Starlet.

TATSUMAKI?
    Tatsumaki is a Japanese for Tornado. Also, it might sound familiar from

lib/Tatsumaki.pm  view on Meta::CPAN

Feel free to hack on it and ask me if you have questions or
suggestions at IRC: #plack on irc.perl.org.

=head1 DESCRIPTION

Tatsumaki is a toy port of Tornado for Perl using Plack (with
non-blocking extensions) and AnyEvent.

It allows you to write a web application that does a immediate
response with template rendering, IO-bound delayed response (like
fetching third party API or XML feeds), server push streaming and
long-poll Comet in a clean unified API.

=head1 PSGI COMPATIBILITY

When C<asynchronous> is declared in your application, you need a PSGI
server backend that supports C<psgi.streaming> response style. If your
application does server push with C<stream_write>, you need a server
that supports C<psgi.nonblocking> (and C<psgi.streaming>) as well.

Currently Tatsumaki asynchronous application is supposed to run on
L<Twiggy>, L<Feersum>, L<Corona> and L<POE::Component::Server::PSGI>.

If C<asynchronous> is not used, your application is supposed to run in
any PSGI standard environments, including blocking multiprocess
environments like L<Starman> or L<Starlet>.

=head1 TATSUMAKI?

lib/Tatsumaki/Handler.pm  view on Meta::CPAN

        $self->_write_buffer([]);
    } elsif (!$self->is_asynchronous || $is_final) {
        my $body = $self->response->body || [];
        push @$body, @{$self->_write_buffer};
        $self->_write_buffer([]);
        $self->response->body($body);
    } else {
        my $res = $self->response->finalize;
        delete $res->[2]; # gimme a writer
        $self->condvar->send($res);
        $self->writer or Carp::croak("Can't get a writer object back: you need servers with psgi.streaming");
        $self->flush();
    }
}

sub finish {
    my($self, $chunk) = @_;
    $self->write($chunk) if defined $chunk;
    $self->flush(1);
    if ($self->writer) {
        $self->writer->close;



( run in 0.235 second using v1.01-cache-2.11-cpan-4d50c553e7e )