[Dancer-users] more request for "Running multiple apps with Plack::Builder"

Takeshi OKURA okura3 at gmail.com
Wed Jun 15 17:05:21 CEST 2011


In "Dancer::Deployment"
section "Running multiple apps with Plack::Builder"
example script app.psgi cause runtime error.
  Odd number in 'set' assignment
  unable to load application app1
.

I think this workaround is
--- app.psgi.orig	2011-06-15 23:18:34.005384527 +0900
+++ app.psgi	2011-06-15 23:42:10.281362715 +0900
@@ -5,18 +5,24 @@

 my $app1 = sub {
     my $env = shift;
-    setting appdir => '/path/to/app1',
+    local $ENV{DANCER_APPDIR} = '/path/to/app1';
+    setting appdir => '/path/to/app1';
+    setting public  => '/path/to/app1/public';
     setting appname => 'app1';
     load_app "app1";
+    Dancer::App->set_running_app('app1');
     Dancer::Config->load;
     my $request = Dancer::Request->new( env => $env );
     Dancer->dance( $request );
 };
 my $app2 = sub {
     my $env = shift;
-    setting appdir => '/path/to/app2',
+    local $ENV{DANCER_APPDIR} = '/path/to/app2';
+    setting appdir => '/path/to/app2';
     setting appname => 'app2';
+    setting public  => '/path/to/app2/public';
     load_app "app2";
+    Dancer::App->set_running_app('app2');
     Dancer::Config->load;
     my $request = Dancer::Request->new( env => $env );
     Dancer->dance( $request );

Please review the app.psgi example script.

-- 
Takeshi OKURA


More information about the Dancer-users mailing list