[Catalyst] problem with Authentication::CDBI, or something else?

samwyse samwyse at gmail.com
Sat Jun 11 00:17:55 CEST 2005


On 6/10/05, Marcello <m.romani at spinsoft.it> wrote:
> samwyse ha scritto:
> > ### The following code was copied pretty much verbatim from
> > Catalyst::Manual::Cookbook:
> >
> > package MyApp;
> >
> > use strict;
> > use Catalyst qw/ -Debug Static Session::FastMmap Authentication::CDBI /;
> >
[...]
> >
> > sub login : Local {
> >     my ( $self, $c ) = @_;
> >     if ($c->req->params->{username}) {   ### line 41 ###
> >           $c->session_login(
> >                   $c->req->params->{username},
> >                   $c->req->params->{password} );
>
> I had a similar problem.
> The login method in your app conflicts with the one imported from the
> plugin.
> You should give your method a different name.

Thanks, I had just figured that out.  Which leads to another question or two.

1)  Catalyst::Manual::Cookbook uses this snippet:
  sub 'login' : Local {
but when I use a single-quoted 'login' as a subroutine name in my
version of Perl (v5.8.6 built for cygwin-thread-multi-64int), I get an
error about an illegal declaration of a subroutine.  Is this something
that should be working for me?

2)  Catalyst::Manual::Cookbook doesn't really say where the login sub
should be placed, but the only location that gets mentioned anywhere
is the MyApp package.  I'm going to presume that a sub named 'login'
will magically work if I drop it into a different package, presumably
a Controller package.  OTOH, I got it to work in the main package by
coding this:
  sub my_login : Path('/login') {
Could/would someone update the cookbook to discuss these points?

Thanks!



More information about the Catalyst mailing list