Thanks David. On Mon, Aug 2, 2010 at 4:34 PM, David Precious <davidp@preshweb.co.uk> wrote:
On Monday 02 August 2010 22:08:39 P Kishor wrote:
What I don't understand is, why is no one else encountering these errors that I am? My set up is fairly run of the mill, very routine. Nothing exotic at all. Yet, I am encountering errors at every step, and none of them seem to be reflected in the docs.
Maybe most people are running their apps via different methods, for instance using Apache & Plack (using Plack::Handler::Apache2 as documented at: http://search.cpan.org/dist/Dancer/lib/Dancer/Deployment.pod#Running_from_Ap... ) - I can confirm that that method definitely works for me, although I have experienced odd problems with multiple Dancer apps running that way, which I need to investigate further. ..
Ok, the Plack method works for me also, but first, my notes below, and then a comment. The Dancer docs at http://search.cpan.org/~sukria/Dancer-1.1805/lib/Dancer/Deployment.pod say Running from Apache with Plack ------------------------------ You can run your app from Apache using PSGI (Plack), with a config like the following: <VirtualHost myapp.example.com> ServerName www.myapp.example.com ServerAlias myapp.example.com DocumentRoot /websites/myapp.example.com <Location /> SetHandler perl-script PerlHandler Plack::Handler::Apache2 PerlSetVar psgi_app /websites/myapp.example.com/app.psgi </Location> ErrorLog /websites/myapp.example.com/logs/error_log CustomLog /websites/myapp.example.com/logs/access_log common </VirtualHost> While the Plack::Handler::Apache2 docs at http://search.cpan.org/~miyagawa/Plack-0.9943/lib/Plack/Handler/Apache2.pm say <Location /> SetHandler perl-script PerlResponseHandler Plack::Handler::Apache2 PerlSetVar psgi_app /path/to/app.psgi </Location> # Optional, preload the application in the parent like startup.pl <Perl> use Plack::Handler::Apache2; Plack::Handler::Apache2->preload("/path/to/app.psgi"); </Perl> That discrepancy is confusing. The Plack docs don't mention "PerlHandler" at all, while the Dancer docs don't mention "PerlResponseHandler" at all. Those two should be reconciled one way or the other, else they are confusing. The above does work for me, but there is a huge pre-condition. I need to have mod_perl installed. See the Dancer docs (above). They don't mention that mod_perl is needed to run Dancer via Plack::Handler::Apache2. Now, this may be obvious as a brick on the head to those who know, but remember, the key selling point of Dancer is simplicity. Which means, even the complicated should be simple. Computer users are notorious for not reading the instructions, but we should at least note everything down, no matter how obvious. So, the following change to the docs would be helpful. Running from Apache with Plack ------------------------------ You can run your app from Apache using PSGI (Plack). Please note, in order to run Perl modules via Apache, you need mod_perl, so make sure mod_perl 2 or above is installed. Then, install Plack::Handler::Apache2. Finally, use the configuration below in your Apache httpd-vhosts.conf file. Finally, while I do have the above running, it is absolutely essential to have cgi mode running. I would contend that most people using shared web hosting do not have access to persistent processes such as mod_perl. They get what they get from their hosting service. Most good ones now allow installing local Perl libs, even compiled ones, or will compile standard modules for you, but none of them I know allow you to tinker with Apache. I have run my web sites with cgi for years, and they function just well. I am no Amazon. I am happy if I get 10 hits a day, so cgi speed is not a concern... its ease of deployment is an attraction. Of course, the best framework will be the one that is not only easy, but also allows multiple ways of deployment without requiring any change in the code. I think Dancer is getting there, but its docs certainly need work. -- Puneet Kishor http://www.punkish.org Carbon Model http://carbonmodel.org Charter Member, Open Source Geospatial Foundation http://www.osgeo.org Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor Nelson Institute, UW-Madison http://www.nelson.wisc.edu ----------------------------------------------------------------------- Assertions are politics; backing up assertions with evidence is science =======================================================================