Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Sledge::Request::PSGI#finalize

  • Loading branch information...
commit 61887a1f52c078c9a4f9dbee35aa34bd269177fe 1 parent 0d8e304
@spiritloose authored
Showing with 19 additions and 9 deletions.
  1. +2 −2 lib/Sledge/Pages/PSGI.pm
  2. +17 −7 lib/Sledge/Request/PSGI.pm
View
4 lib/Sledge/Pages/PSGI.pm
@@ -7,9 +7,9 @@ use Sledge::Request::PSGI;
sub dispatch {
my ($self, $page) = @_;
- my $res = $self->r->res;
+ my $r = $self->r;
$self->SUPER::dispatch($page);
- $res->finalize;
+ $r->finalize;
}
sub create_request {
View
24 lib/Sledge/Request/PSGI.pm
@@ -5,6 +5,7 @@ use warnings;
use Sledge::Request::Table;
use Plack::Request;
use Plack::Response;
+use Sledge::Request::CGI;
sub new {
my ($class, $env) = @_;
@@ -27,12 +28,10 @@ sub header_out {
sub headers_out {
my $self = shift;
- my %header_hash;
- $self->res->headers->scan(sub {
- $header_hash{$_[0]} = $_[1];
- });
- return wantarray ? %header_hash
- : Sledge::Request::Table->new(\%header_hash);
+ my %hdr;
+ $self->res->headers->scan(sub { $hdr{$_[0]} = $_[1] });
+ return wantarray ? %hdr
+ : Sledge::Request::Table->new(\%hdr);
}
sub header_in {
@@ -47,6 +46,11 @@ sub content_type {
sub send_http_header {}
+sub method {
+ my $self = shift;
+ $self->query->method || 'GET';
+}
+
sub status {
my ($self, $status) = @_;
$self->res->status($status);
@@ -54,7 +58,8 @@ sub status {
sub print {
my $self = shift;
- my $body = ($self->res->body || '') . join('', @_);
+ my $body = $self->res->body || [];
+ push @$body, @_;
$self->res->body($body);
}
@@ -88,6 +93,11 @@ sub pnotes {
}
}
+sub finalize {
+ my $self = shift;
+ $self->res->finalize;
+}
+
sub AUTOLOAD {
(my $meth = our $AUTOLOAD) =~ s/.*:://;
no strict 'refs';
Please sign in to comment.
Something went wrong with that request. Please try again.