<DIV>It is working after 'sub login' moved to controller MyApp::C::Login<BR>I appreciate your help. Thanks a lot.</DIV>
<DIV><BR><B><I>michael reece <mreece@sacbee.com></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">i ran into this, too. putting your 'sub login' in your app causes it <BR>to conflict with the login sub that is imported from the Auth::CDBI <BR>plugin.<BR><BR>put it in MyApp::C::Login as sub login : Global, and then $c->forward <BR>('/login/login')<BR><BR>(or call it signin instead of login, if it must live in MyApp. but <BR>you'll run into this with any sub name that conflicts with any sub <BR>name on any plugin, so get used to separate controllers)<BR><BR><BR>On Jun 1, 2005, at 12:19 PM, Srinivasa Mullangi wrote:<BR><BR>> Hi,<BR>><BR>> I am trying to implement 'Authentication with <BR>> Catalyst::Plugin::Authentication::CDBI' example from the cook book.<BR>><BR>> Here is my config and code<BR>> authentication => { user_class => 'User',<BR>> user_field => 'email',<BR>> password_field => 'password',<BR>> role_class => 'Roles',<BR>>
&! nbsp; user_role_class => 'UserRoles',<BR>> user_role_user_field => 'user_id',<BR>> user_role_role_field => 'role_id',<BR>> },<BR>> sub begin : Private {<BR>> my ( $self, $c ) = @_;<BR>> unless ($c->req->{user}) {<BR>> $c->req->action(undef);<BR>> $c->forward('/login');<BR>> }<BR>> }<BR>> my $loginprofile = {<BR>> required => [qw(username password)],<BR>> };<BR>><BR>> sub login : Local {<BR>> my ($self, $c) = @_;<BR>> $c->stash->{template} = 'template/login.tt';<BR>> if($c->req->params->{submit}) {<BR>> my $results = Data::FormValidator->check($c->req- <BR>> >params, $loginprofile);<BR>> if($results->has_missing() || $results->has_invalid <BR>> ()) {<BR>> $c->stash->{error} = 'Error in the <BR>> submitted data';<BR>> $c->stash->{results} = $results;<BR>> return;<BR>> }<BR>>
$c->session_login($c->req->params->{username}, $c- <BR>> >req->params->{password});<BR>> if ($c->req->{user}) {<BR>> $c->forward('/');<BR>> }<BR>> }<BR>> }<BR>><BR>> I created an user with email: 'mullangi@rocketmail.com' and <BR>> password 'abcde'.<BR>> I am getting the following error from the method $c->session_login <BR>> (...)<BR>><BR>> [Wed Jun 1 10:45:27 2005] [catalyst] [error] Caught exception <BR>> "Can't locate object method "log" via package <BR>> "mullangi@rocketmail.com" (perhaps you forgot to load <BR>> "mullangi@rocketmail.com"?) at /var/www/BettyMills-Admin/script/../ <BR>> lib/BettyMills/Admin.pm line 54."<BR>> Please advise on what is going wrong and how to fix.<BR>><BR>> Thanks<BR>> Srini<BR>><BR>> __________________________________________________<BR>> Do You Yahoo!?<BR>> Tired of spam? Yahoo! Mail has the best spam protection around<BR>>
http://mail.yahoo.com<BR>><BR>> _______________________________________________<BR>> Catalyst mailing list<BR>> Catalyst@lists.rawmode.org<BR>> http://lists.rawmode.org/mailman/listinfo/catalyst<BR>><BR><BR></BLOCKQUOTE><p>
                <hr size=1>Discover Yahoo!<br>
Stay in touch with email, IM, photo sharing & more. <a href="http://us.rd.yahoo.com/evt=32659/*http://discover.yahoo.com/stayintouch.html">Check it out!</a>