Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: Dancer + cgi

by slatibart (Sexton)
on Mar 20, 2012 at 18:50 UTC ( #960626=note: print w/replies, xml ) Need Help??

in reply to Re: Dancer + cgi
in thread Dancer + cgi

I don't get it. Dancer::Deployment says:

In providing ultimate flexibility in terms of deployment, your Dancer app can be run as a simple cgi-script out-of-the-box. No additional web-server configuration needed. Your web server should recognize .cgi files and be able to serve Perl scripts.

use Dancer; get '/' => sub { return 'Hello World!'; }; dance;
still binds to Port 3000.
print "Content-type: text/html\n\n"; print "hello";

but this perl script is working.

Still clueless after reading a lot of documentation.

Replies are listed 'Best First'.
Re^3: Dancer + cgi
by druthb (Beadle) on Mar 20, 2012 at 18:58 UTC

    In that same paragraph, Dancer::Deployment asserts that you have to have Plack::Runner installed. (Not, mind, that you have to use it) It *sounds* like it might not be, maybe. I've not had the problem you're describing, so I'm kinda feeling around here. And yeah, you'll need to at least set up a rewrite rule in .htaccess, even if you can't monkey with the server Apache config.

    The only time I've seen a Dancer script bind on its' own, is when you run it from the command line, so what you're describing seems very peculiar to me.

    D Ruth Bavousett
Re^3: Dancer + cgi
by aaron_baugher (Curate) on Mar 21, 2012 at 10:37 UTC

    When you run a Dancer app as a CGI, you don't run your script that has 'dance' in it. You use the httpd.conf or .htaccess rewrite rules in the first section of Dancer::Deployment, which redirects all URLs through the dispatch.cgi (or dispatch.fcgi for FastCGI) that is created when you create your Dancer app with the 'dancer' program. That dispatch program takes the URLs and passes them to your routes, after which point it works like it'd work as a standalone server or using any other deployment method.

    Aaron B.
    My Woefully Neglected Blog, where I occasionally mention Perl.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://960626]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2020-09-27 07:47 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (142 votes). Check out past polls.