| HTTP-Engine-Compat documentation | Contained in the HTTP-Engine-Compat distribution. |
HTTP::Engine::Compat::Context - Context object
my $c = shift;
Kazuhiro Osawa and HTTP::Engine Authors.
$c->req
The instance of the HTTP::Engine::Request.
$c->res
The instance of the HTTP::Engine::Response.
| HTTP-Engine-Compat documentation | Contained in the HTTP-Engine-Compat distribution. |
package HTTP::Engine::Compat::Context; use Moose; use HTTP::Engine::Request; use HTTP::Engine::Response; has req => ( is => 'rw', isa => 'HTTP::Engine::Request', required => 1, default => sub { my $self = shift; HTTP::Engine::Request->new( context => $self, request_builder => HTTP::Engine::RequestBuilder->new(), _connection => { input_handle => \*STDIN, output_handle => \*STDOUT, env => \%ENV, }, ); }, trigger => sub { my ( $self, $new_req ) = @_; $new_req->context($self); }, ); has res => ( is => 'rw', isa => 'HTTP::Engine::Response', required => 1, default => sub { HTTP::Engine::Response->new; }, ); # shortcut. *request = \&req; *response = \&res; __PACKAGE__->meta->make_immutable; 1; __END__