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

Marcello m.romani at spinsoft.it
Fri Jun 10 18:50:36 CEST 2005


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 /;
> 
> our $VERSION = '0.01';
> 
> MyApp->config(
> 	name => 'MyApp',
> 	authentication => {
> 		user_class => 'MyApp::M::MyCDBI::User.pm',
> 		user_field => 'email',
> 		password_field => 'password',
> 	},
> );
> 
> MyApp->setup;
> 
> sub login : Local {
>     my ( $self, $c ) = @_;
>     if ($c->req->params->{username}) {   ### line 41 ###
> 	    $c->session_login(
> 		    $c->req->params->{username},
> 		    $c->req->params->{password} );
> 
> 
> ### When I run it (using 'myself' as the username), I get the
> following traceback:
> 
> Caught exception "Can't locate object method "req" via package
> "myself" (perhaps you forgot to load "myself"?) at
> /home/dentos/MyApp/script/../lib/MyApp.pm line 41."
> 
> Request

[snip]

> 
> 
> ### I just checked, and at line 41 $c is MyApp=HASH(0x10dcaefc). 
> Anyone have any ideas?
> 
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
> 

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.

Marcello



More information about the Catalyst mailing list