[Dancer-users] catching routes with r('.*')

P Kishor punk.kish at gmail.com
Sun Aug 15 18:06:48 CEST 2010

So, the only way I am able to get Dancer 1.1805 deploy under Apache2
CGI is by using

get r('.*') => sub {}

Unfortunately, I can't seem to figure out how to use the captured
route value. `splat` doesn't seem to do the trick. For example

get r('.*') => \&default;

sub default {
    my ($route) = splat;
    my $route = $route ? $route : 'welcome';

    my $template_opts = {
    	route => $route

    template 'index.tt', $template_opts;

and then, in my index.tt

Hello, and [% route %].

However, when I go to http://myapp/, I get

Hello, and 1.

If I go to http://myapp/foo, I get a 404 again.

I believe I might just be back at an impasse whereby I am simply
unable to run Dancer with Apache2 under CGI.

A bit of an explanation as to why I am adamant about Apache2/CGI. It
is the second easiest environment to develop under, for me at least.
While launching `perl ./myapp.pl` on port 3000 is the easiest, that is
not even an intermediate term solution. My servers run Apache or
Apache2, and even my shared web servers run Apache/Apache2. My web
site is not very high traffic, so CGI serves just as well for me. I
believe Apache2/CGI can easily serve several 10s of thousands of hits
a day.

Once I need it, I can and will move to mod_perl, in which case I can
use Plack, however, even with Plack, I am running into the dreaded 404
error. However, mod_perl is considerably more difficult to install on
different servers, so CGI is the preferred option.

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

More information about the Dancer-users mailing list