concrete
This commit is contained in:
22
lib/CW/Plack/Request.pm
Normal file
22
lib/CW/Plack/Request.pm
Normal file
@@ -0,0 +1,22 @@
|
||||
package CW::Plack::Request;
|
||||
|
||||
use Moo;
|
||||
|
||||
has h => (
|
||||
is => 'ro',
|
||||
required => 1
|
||||
);
|
||||
|
||||
has _request => (
|
||||
is => 'ro',
|
||||
init_arg => 'request',
|
||||
required => 1
|
||||
);
|
||||
|
||||
sub new_response {
|
||||
my ( $self, @args ) = @_;
|
||||
my $response = $self->_request->new_response(@args);
|
||||
return CW::Plack::Response->new( response => $response, h => $self->h );
|
||||
}
|
||||
|
||||
1;
|
||||
24
lib/CW/Plack/Response.pm
Normal file
24
lib/CW/Plack/Response.pm
Normal file
@@ -0,0 +1,24 @@
|
||||
package CW::Plack::Response;
|
||||
|
||||
use Moo;
|
||||
|
||||
has _response => (
|
||||
is => 'ro',
|
||||
init_arg => 'response',
|
||||
required => 1,
|
||||
handles => [qw(finalize status body headers header)]
|
||||
);
|
||||
|
||||
has h => (
|
||||
is => 'ro',
|
||||
required => 1
|
||||
);
|
||||
|
||||
sub template {
|
||||
my ( $self, $template ) = @_;
|
||||
my $html = $self->h->html($template);
|
||||
$self->_response->body($html);
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user