X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Flib%2FTestFromPSGI%2FController%2FRoot.pm;fp=t%2Flib%2FTestFromPSGI%2FController%2FRoot.pm;h=f3a0477230c3e2bbb4ca941916374999b9111f50;hp=7c116a5867a761ec5fd82f99e21a0412b739d271;hb=4491e0cc34b2be2fc485ad01fbbf51b61fed4c22;hpb=d3ea94fca0bdddf69d008424f279a4271bcdc4ae diff --git a/t/lib/TestFromPSGI/Controller/Root.pm b/t/lib/TestFromPSGI/Controller/Root.pm index 7c116a5..f3a0477 100644 --- a/t/lib/TestFromPSGI/Controller/Root.pm +++ b/t/lib/TestFromPSGI/Controller/Root.pm @@ -1,13 +1,56 @@ -package TestMiddleware::Controller::Root; +package TestFromPSGI::Controller::Root; use Moose; use MooseX::MethodAttributes; extends 'Catalyst::Controller'; -sub default : Path { } -sub welcome : Path(welcome) { - pop->res->body('Welcome to Catalyst'); +sub test_psgi_keys :Local Args(1) { + my ($self, $c, $key) = @_; + $c->res->body($c->req->env->{$key}); +} + +sub from_psgi_array : Local { + my ($self, $c) = @_; + my $res = sub { + my ($env) = @_; + return [200, ['Content-Type'=>'text/plain'], + [qw/hello world today/]]; + }->($c->req->env); + + $c->res->from_psgi_response($res); +} + +sub from_psgi_code : Local { + my ($self, $c) = @_; + + my $res = sub { + my ($env) = @_; + return sub { + my $responder = shift; + return $responder->([200, ['Content-Type'=>'text/plain'], + [qw/hello world today2/]]); + }; + }->($c->req->env); + + $c->res->from_psgi_response($res); +} + +sub from_psgi_code_itr : Local { + my ($self, $c) = @_; + my $res = sub { + my ($env) = @_; + return sub { + my $responder = shift; + my $writer = $responder->([200, ['Content-Type'=>'text/plain']]); + $writer->write('hello'); + $writer->write('world'); + $writer->write('today3'); + $writer->close; + }; + }->($c->req->env); + + $c->res->from_psgi_response($res); } __PACKAGE__->meta->make_immutable;