0
votes

I have a prototype application (RESTful web service database front-end) that is written using Dancer. As a prototype this runs fine under Apache with mod_proxy, and Dancer's routes work really nice.

My next step is to see if I can get this to scale a bit as some of the queries can be very slow and I don't want the slow queries blocking other requests.

I'd like to use rpms to manage the needed perl modules. For Dancer, this is no problem as CentOS-6 plus EPEL provide sufficient rpms to allow me to build/install Dancer and Dancer::Plugin::Database rpms. Trying to build Plack rpms isn't working nearly as well however due to a varietly of reasons, one of which is that some of the system modules are too low a version number (and no, overwriting the system rpms with higher version local builds is not considered an option).

EPEL does provide rpms for CGI::Emulate::PSGI and HTTP::Server::Simple::PSGI but I'm not seeing how to wrangle either one of them into a desired solution.

So, my question is: Is there a clean/maintainable way to get Dancer running on CentOS-6 with pre-forking? Barring that, how does one get Apache to play nicely with a local perl install (where I can use tools like cpanm to install things)?

2
why not install a modern perl version with perlbrew ? - Miguel Prz
Any reason not to set up a local Perl environment with local::lib or perlbrew? - matthias krull
MiguelPrz/mugen keichi-- I could do that, and have for other things (be nice not to have to). Additionally, I'm not sure how that will play with Apache (mt Apache-foo is not strong)-- is it a matter of setting the correct environment variables, does the perl version matter (thinking mod_perl here) or is that really a non-issue? - gsiems
You compile mod_perl against a concrete perl. So you install your own perl and compile mod_perl with it. Then in apache config you load your own mod_perl instead of the system one. - jira
@Miguel Prz -- Since you were the first to suggest perlbrew, which is the approach that I finally adopted (completely avoiding use of the system perl)-- would you care to make your comment an answer so that I may accept it? - gsiems

2 Answers

0
votes

I highly recommend you the use of perlbrew, and forget the system perl.

0
votes

If you want to restrict yourself to the packages shipped with CentOS, then you can run your Dancer app under mod_perl. There is a Plack adapter for mod_perl, so it is rather straightforward.

For example

<Location /myapp>
  SetHandler perl-script
  PerlHandler Plack::Handler::Apache2
  PerlSetVar psgi_app /var/www/html/myapp.example.com/app.psgi
</Location>