Making Dancer Dance on CGI A.K.A. Blog Fix #543

xsawyerx on 2010-01-12T17:35:33

this was originally posted on my new blogs.perl.org journal, which can be found here.

So, last blog entry I mentioned Dancer and that I want to use it as CGI (since it's Plack-aware) but I don't know how.

Nick Spacek commented on my entry saying that if it supports Plack/PSGI, there should be an easy way to run it as CGI.

Later that evening I sat down for hummus with my girlfriend (hummus is awesome, ok?). After talking to her about it, I decided to take a minute to check online on my phone if anyone has any explanations on it. In the first 5 results, I found a post Alexis Sukriah (who wrote Dancer!) wrote that same day, regarding my post, showing how to use Plack to run a Dancer app under CGI!

Case in point:

use Plack::Server::CGI;
use Plack::Util;

my $psgi = '/path/to/your/app/app.psgi';
my $app = Plack::Util::load_psgi($psgi);
Plack::Server::CGI->new->run($app);

... and the web server configuration to use it.
(example shown on Alexis' post)

account with lotsa forks and cares very much about community and communal programming. I have to say, that's a major high point in any module/program/framework I want to use.

So, I stand corrected. Plack is awesomer than originally thought.

miyagawa++, sukriah++ :)