[dancer-users] Plack builder error
mark jones
mjemail at me.com
Wed Feb 11 09:57:52 GMT 2015
Hi all,
I'm pretty new to Dancer and I'm trying to put together a quick demo with Plack::Builder and multiple apps.
I've created 2 apps in separate directories - app1 and app2, and in a directory above I've got app.psgi with the following code:
use Dancer2 ':syntax';
use Plack::Builder;
use lib '/home/mj/app1/lib';
use lib '/home/mj/app2/lib';
use app1;
use app2;
setting apphandler => 'PSGI';
my $app1 = sub {
my $env = shift;
local $ENV{DANCER_APPDIR} = '/home/mj/app1';
load_app "app1";
Dancer2::App->set_running_app('app1');
setting appdir => '/home/mj/app1';
Dancer2::Config->load;
my $request = Dancer2::Request->new( env => $env );
Dancer2->dance($request);
};
my $app2 = sub {
my $env = shift;
local $ENV{DANCER_APPDIR} = '/home/mj/app2';
load_app "app2";
Dancer2::App->set_running_app('app2');
setting appdir => '/home/mj/app2';
Dancer2::Config->load;
my $request = Dancer2::Request->new( env => $env );
Dancer2->dance($request);
};
builder {
mount "/app1" => builder {$app1};
mount "/app2" => builder {$app2};
};
Following the tutorial here: http://search.cpan.org/~sukria/Dancer2-0.05/lib/Dancer2/Deployment.pod#Running_multiple_apps_with_Plack::Builder.
I keep getting this error:
String found where operator expected at /home/mj/app.psgi line 16, near "load_app "app1""
(Do you need to predeclare load_app?)
It's probably something really simple but can anyone see what's wrong?
Cheers
More information about the dancer-users
mailing list