[Catalyst] Authentication::Store::DBIC => Can't call method "search" in uthentication::Store::DBIC::User ???
T. H. Lin
easy.lin at gmail.com
Sun Apr 23 00:55:47 CEST 2006
MyApp.pm
=========
use Catalyst qw/-Debug
ConfigLoader
Static::Simple
DefaultEnd
Authentication
Authentication::Store::DBIC
Authentication::Credential::Password
I18N/;
__PACKAGE__->setup;
======================
MyApp/Controller/Login.pm
======================
sub begin : Private {
my ( $self, $c ) = @_;
$c->config->{authentication}{dbic} = {
user_class => 'DBIC::User',
user_field => 'name',
password_field => 'pass',
password_type => 'hashed',
password_hash_type => 'SHA-256',
};
}
sub default : Private {
my ( $self, $c ) = @_;
if ( my $user = $c->req->param("user")
and my $password = $c->req->param("password") )
{
if ( $c->login( $user, $password ) ) {
$c->res->body( "hello " ) . $c->user->name );
} else { ... }
}
else { .. }
}
=========================================
then I connect to /account
ERROR
Caught exception in MyApp::Controller::Account->default "Can't call
method "search" on an undefined value at
/usr/local/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/Authentication/Store/DBIC/User.pm
line 15."
??why Catalyst/Plugin/Authentication/Store/DBIC/User.pm ??
I see the code, there is something like... $config->{auth}
I try to dump my $c->config
$c->config->{auth} is undef!
More information about the Catalyst
mailing list