[Catalyst] Catalyst::Plugin::Authentication::Store::DBIC and config in auto

fayland fayland at gmail.com
Thu Mar 23 05:36:39 CET 2006


hi, all.
Since we use more than one database server, I need to connect database 
in sub auto of Root.pm.
so I config the Catalyst::Plugin::Authentication::Store::DBIC after the 
connect like this:

sub auto : Private {
    my ( $self, $c ) = @_;

    # connect db
    $c->forward('init');
   
    use Data::Dumper;
    
$c->log->debug(Dumper($c->config->{dbic}{geo}->resultset('User')->search({})->first));
    $c->config->{authentication}{dbic} = {
        user_class         => $c->config->{dbic}{geo}->resultset('User'),
        user_field         => 'username',
        password_field     => 'password',
    };

the debug screen shows that ->resultset('User')->search({})->first 
works. but the Catalyst::Plugin::Authentication::Store::DBIC complains :
|
Caught exception in Zorpia::Controller::User->login "Can't call method 
"search" on an undefined value at

any suggestion? can I config the DBIC in the auto?

Thanks. any tip is appreciated very much.

Best Regards,
|

-- 
Fayland Lam // http://www.fayland.org/ 




More information about the Catalyst mailing list