[Catalyst-commits] r12586 - Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Sun Jan 10 00:33:41 GMT 2010


Author: t0m
Date: 2010-01-10 00:33:41 +0000 (Sun, 10 Jan 2010)
New Revision: 12586

Modified:
   Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Engine.pm
   Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/ScriptRole.pm
   Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Test.pm
Log:
Use Plack::Loader and push the running of plack back into the engine code. Unsure if here or scriptrole is the best place for it, thoughts? (48 => 13 fails though)

Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Engine.pm	2010-01-10 00:00:43 UTC (rev 12585)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Engine.pm	2010-01-10 00:33:41 UTC (rev 12586)
@@ -11,6 +11,7 @@
 use HTTP::Headers;
 use URI::QueryParam;
 use Moose::Util::TypeConstraints;
+use Plack::Loader;
 
 use namespace::clean -except => 'meta';
 
@@ -747,8 +748,14 @@
 =cut
 
 sub run {
-    my ($self, $app) = @_;
+    my ($self, $app, @args) = @_;
+    Carp::cluck("Run");
+    # FIXME - Do something sensible with the options we're passed
+    $self->_run_psgi_app($self->_build_psgi_app($app, @args), @args);
+}
 
+sub _build_psgi_app {
+    my ($self, $app, @args) = @_;
     return sub {
         my ($env) = @_;
 
@@ -760,6 +767,12 @@
     };
 }
 
+sub _run_psgi_app {
+    my ($self, $psgi_app, @args);
+    # FIXME - Need to be able to specify engine and pass options..
+    Plack::Loader->auto()->run($psgi_app);
+}
+
 =head2 $self->write($c, $buffer)
 
 Writes the buffer to the client.

Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/ScriptRole.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/ScriptRole.pm	2010-01-10 00:00:43 UTC (rev 12585)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/ScriptRole.pm	2010-01-10 00:33:41 UTC (rev 12586)
@@ -60,8 +60,7 @@
     my $self = shift;
     my $app = $self->application_name;
     Class::MOP::load_class($app);
-    my $psgi_app = $app->run($self->_application_args);
-    Plack::Runner->run('--app' => $psgi_app);
+    $app->run($self->_application_args);
 }
 
 1;

Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Test.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Test.pm	2010-01-10 00:00:43 UTC (rev 12585)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Test.pm	2010-01-10 00:33:41 UTC (rev 12586)
@@ -27,7 +27,7 @@
         }
         $class->import;
 
-        my $app = $class->run;
+        my $app = $class->engine->_build_psgi_app($class);
 
         $request = sub { local_request( $app, @_ ) };
     }




More information about the Catalyst-commits mailing list