[cgiapp] C::A::P::Routes
P Kishor
punk.kish at gmail.com
Wed Mar 3 16:56:07 EST 2010
A while back I attempted working with CAPRoutes, but failed. Today I
decided to revisit it, and failed again. In fact, I am failing at
getting the simplest possible application running with it, and I am
wondering -- either I am completely clueless about how this is
supposed to work, or this module is just not what it claims to be. I
will go with the former assumption, and ask for the list's help here.
My app script is a simple
use App;
my $w = App->new(
TMPL_PATH => "/Sites/app/_tmpl",
PARAMS => {
..
},
);
$w->run();
in my App.pm package, I have
sub setup {
my $self = shift;
$self->routes_root('/app');
$self->routes([
'foo/:page?' => 'foo',
'/:page?' => 'foo',
'' => 'foo',
'bar/:page' => 'bar',
'baz/:page' => 'baz',
]);
$self->start_mode('foo');
$self->tmpl_path( '/Sites/app/_tmpl' );
}
Ok. Here is all that goes wrong --
1. Why do I need to provide $self->tmpl_path( '/Sites/app/_tmpl' ); in
my App.pm even though I have TMPL_PATH => "/Sites/app/_tmpl", in my
app.cgi? (this is not a CAPRoutes specific question). If I comment out
$self->tmpl_path, the script errors out. If that is what is needed,
then why even give me the option of declaring TMPL_PATH in my app.cgi?
2. I have CAPRoutes 1.02. If I do a simple 'my $debug =
$self->routes_dbg;' in a run mode in my App.pm, the script dies with
the error that "Undefined subroutine
&CGI::Application::Plugin::Routes::Dumper called at
/usr/local/lib/perl5/site_perl/5.10.1/CGI/Application/Plugin/Routes.pm
line 49." Line 48, 49 happen to be
require Data::Dumper;
return Dumper($self->{'Application::Plugin::Routes::__r_params'});
If I replace 'require Data::Dumper' with 'use Data::Dumper' the error
goes away, but nothing is dumped out. The
$self->{'Application::Plugin::Routes::__r_params'} var is completely
empty.
3. Finally, CAPRoutes doesn't seem to match any routes at all. No
matter what my path_info, it always defaults to the start mode 'foo'.
So, please, please let me be the clueless one here and set me right,
otherwise, it will be baffling how a module that doesn't work at all
got onto CPAN.
Many thanks,
--
Puneet Kishor
More information about the cgiapp
mailing list