The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
#!/usr/bin/env perl

use Dancer ':syntax';
use FindBin '$RealBin';
use Plack::Handler::FCGI;

# For some reason Apache SetEnv directives dont propagate
# correctly to the dispatchers, so forcing PSGI and env here 
# is safer.
set apphandler => 'PSGI';
#set environment => 'production';
set environment => $ENV{CPAN_DIGGER_ENV};

my $psgi = path($RealBin, '..', 'bin', 'app.pl');
my $app = Plack::Util::load_psgi($psgi);
#my $app = do($psgi);
die $! if not defined $app;
my $server = Plack::Handler::FCGI->new(nproc => 5, detach => 1);

$server->run($app);