[Catalyst] Login problem with Cat5

Michael Reece mreece at sacbee.com
Tue Apr 19 00:47:40 CEST 2005


I am in the process of converting my Cat4 app to Cat5.

My 'sub begin : Private' forwards to /login unless $c->session->{user} ..

Sub login looks like this:

sub login : Local {
  warn "login args:\n\t", join "\n\t", @_;
  warn "called by\n\t ", join "\n\t", caller;
    my ($self, $c) = @_;
    $c->stash->{template} = 'login';
    if ($c->req->params->{username}) {
        $c->session_login($c->req->params->{username},
                          $c->req->params->{password} );
        if ($c->session->{user}) {
            $c->stash->{template} = '/';
            $self->user_log($c, $c->session->{user}, "logged in");
        }
    }
}


The problem is when C::P::A::CDBI session_login calls
    $c->login( $user, $password );
it invokes the sub login on MyApp, rather than the sub login in
C::P::A::CDBI.

Is there a way around this, short of changing the action to do_login?


(I also have a problem where all my actions are being called with first arg
of MyApp::C::CRUD -- presumably the first match for ^MyApp in the loaded
components? -- instead of MyApp ..)



[Mon Apr 18 15:38:53 2005] [catalyst] [debug] Loaded private actions
.=-------------------------------------+------------------------------------
| Private                              | Class
|=-------------------------------------+------------------------------------
| /end                                 | MyApp
| /begin                               | MyApp
| /css                                 | MyApp
| /login                               | MyApp
| /logout                              | MyApp
| /default                             | MyApp
| /static                              | MyApp
'=-------------------------------------+------------------------------------

[Mon Apr 18 15:38:53 2005] [catalyst] [debug] Loaded public actions
.=-------------------------------------+------------------------------------
| Public                               | Private
|=-------------------------------------+------------------------------------
| /login                               | /login
| /logout                              | /logout
'=-------------------------------------+------------------------------------

[Mon Apr 18 15:38:53 2005] [catalyst] [debug] Loaded regex actions
.=-------------------------------------+------------------------------------
| Regex                                | Private
|=-------------------------------------+------------------------------------
| /^.*\.css$/                          | /css
| /^static\//                          | /static
'=-------------------------------------+------------------------------------

...

[Mon Apr 18 15:39:27 2005] [catalyst] [debug] ******************************
[Mon Apr 18 15:39:27 2005] [catalyst] [debug] * Request 3 (0.086/s) [29915]
[Mon Apr 18 15:39:27 2005] [catalyst] [debug] ******************************
[Mon Apr 18 15:39:27 2005] [catalyst] [debug] Found sessionid
"5285ea745de2ec3935c9df24a2e9cb31" in cookie
[Mon Apr 18 15:39:27 2005] [catalyst] [debug] Requested action is "login"
[Mon Apr 18 15:39:27 2005] [catalyst] [debug] Found session
"5285ea745de2ec3935c9df24a2e9cb31"
[Mon Apr 18 15:39:27 2005] [catalyst] [debug] "POST" request for "login"
from tfwo.sacbee.com(172.21.14.25)
[Mon Apr 18 15:39:27 2005] [catalyst] [debug] Parameters are
.=--------------------------------------+-----------------------------------
| Key                                   | Value
|=--------------------------------------+-----------------------------------
| username                              | guest
| password                              | guest
'=--------------------------------------+-----------------------------------

login args:
        MyApp::C::CRUD=HASH(0x885d6d8)
        MyApp=HASH(0x901d920) at
/usr/local/apache_perl/packages/MyApp/script/../lib/MyApp.pm line 59.
called by
         Catalyst::Engine
        /usr/lib/perl5/site_perl/5.6.1/Catalyst/Engine.pm
        63 at /usr/local/apache_perl/packages/MyApp/script/../lib/MyApp.pm
line 60.
login args:
        MyApp=HASH(0x901d920)
        guest
        guest at 
/usr/local/apache_perl/packages/MyApp/script/../lib/MyApp.pm line 59.
called by
         Catalyst::Plugin::Authentication::CDBI
        
/usr/lib/perl5/site_perl/5.6.1/Catalyst/Plugin/Authentication/CDBI.pm
        174 at /usr/local/apache_perl/packages/MyApp/script/../lib/MyApp.pm
line 60.
[Mon Apr 18 15:39:27 2005] [catalyst] [error] Caught exception "Can't locate
object method "stash" via package "guest" (perhaps you forgot to load
"guest"?) at /usr/local/apache_perl/packages/MyApp/script/../lib/MyApp.pm
line 62."
[Mon Apr 18 15:39:27 2005] [catalyst] [info] Request took 0.008731s
(114.534/s)
.=-----------------------------------------------------------------+--------
| Action                                                           | Time
|=-----------------------------------------------------------------+--------
| /begin                                                           | 0.00093
'=-----------------------------------------------------------------+--------





More information about the Catalyst mailing list