![]() |
![]()
| ![]() |
![]()
NAMEHTTP::Engine::Interface::PSGI - PSGI interface for HTTP::Engine SYNOPSISuse Plack for PSGI Impl use HTTP::Engine; use Plack::Loader; my $engine = HTTP::Engine->new( interface => { module => 'PSGI', request_handler => sub { HTTP::Engine::Response->new( body => 'ok' ); }, }, ); my $app = sub { $engine->run(@_) }; Plack::Loader->load('Standalone', port => 801)->run($app); # see L<Plack::Server::Standalone> and L<Plack::Loader> if you want streaming response use HTTP::Engine; use IO::Handle::Util qw(io_from_getline); # see L<IO::Handle::Util> use Plack::Loader; my $count = 1; my $engine = HTTP::Engine->new( interface => { module => 'PSGI', request_handler => sub { HTTP::Engine::Response->new( body => io_from_getline { return "count: " . $count++ } ); }, }, ); my $app = sub { $engine->run(@_) }; Plack::Loader->load('AnyEvent', port => 801)->run($app); # see L<Plack::Server::AnyEvent> AUTHORyappo SEE ALSOPSGI LICENSEThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|