Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Dancer + cgi

by onelesd (Pilgrim)
on Mar 20, 2012 at 18:16 UTC ( #960616=note: print w/replies, xml ) Need Help??


in reply to Dancer + cgi

Take a look at plackup - it's painless:

plackup -E deployment -s Starman --workers=10 -p 80 -a bin/app.pl

Replies are listed 'Best First'.
Re^2: Dancer + cgi
by slatibart (Sexton) on Mar 20, 2012 at 18:50 UTC
    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.

    but
    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.

      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

      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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2019-11-21 03:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (103 votes). Check out past polls.

    Notices?