[Catalyst] stuck on tutorial's suggested variation

Michael Higgins linux at evolone.org
Tue Dec 4 15:22:10 GMT 2007


All --

Basically, I'm stuck and any leg up would be appreciated.

From Catalyst Tutorial - Part 4: Authentication

"NOTE: You could easily use a single controller here. For example, you
could have a User controller with both login and logout actions.
Remember, Catalyst is designed to be very flexible, and leaves such
matters up to you, the designer and programmer."

So. "Easily" hasn't come to me. If I set up a controller called 'User',
then the "login logic" further down the tutorial page:

            if ($c->login($username, $password)) {

what should $c->login look like if the "login" sub is part of
Controller/User?

There is so much documentation, I really don't know where to find this
information.

What is happening is:

"The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for
this address in a way that will never complete.

    *   This problem can sometimes be caused by disabling or refusing
to accept cookies."

and in my terminal:
[debug] Debug messages enabled
[debug] Loaded plugins:
.----------------------------------------------------------------------------.
| Catalyst::Plugin::Authentication
0.09                                     | |
Catalyst::Plugin::Authentication::Credential::Password
| | Catalyst::Plugin::Authentication::Store::DBIC
0.07                        | | Catalyst::Plugin::Authorization::Roles
0.05                               | | Catalyst::Plugin::Session
0.14                                            | |
Catalyst::Plugin::Session::State::Cookie
0.06                             | |
Catalyst::Plugin::Session::Store::FastMmap
0.02                           | | Catalyst::Plugin::StackTrace
0.06                                         |
'----------------------------------------------------------------------------'

[debug] Loaded dispatcher "Catalyst::Dispatcher"
[debug] Loaded engine "Catalyst::Engine::HTTP"
[debug] Found home "/home/col/charley/bolmaker"
[debug] Loaded components:
.-----------------------------------------------------------------+----------.
| Class                                                           |
Type     |
+-----------------------------------------------------------------+----------+
| bolmaker::Controller::MakeBol                                   |
instance | |
bolmaker::Controller::Root                                      |
instance | |
bolmaker::Controller::User                                      |
instance | |
bolmaker::Model::BanTraceDB                                     |
instance | |
bolmaker::Model::BanTraceDB::Bill2s                             |
class    | |
bolmaker::Model::BanTraceDB::Carriers                           |
class    | |
bolmaker::Model::BanTraceDB::Roles                              |
class    | |
bolmaker::Model::BanTraceDB::Shipments                          |
class    | |
bolmaker::Model::BanTraceDB::UserRoles                          |
class    | |
bolmaker::Model::BanTraceDB::Users                              |
class    | |
bolmaker::View::TT                                              |
instance |
'-----------------------------------------------------------------+----------'

[debug] Loaded Private actions:
.----------------------+--------------------------------------+--------------.
| Private              | Class                                |
Method       |
+----------------------+--------------------------------------+--------------+
| /default             | bolmaker::Controller::Root           |
default      | | /end                 |
bolmaker::Controller::Root           | end          |
| /auto                | bolmaker::Controller::Root           |
auto         | | /makebol/index       |
bolmaker::Controller::MakeBol        | index        |
| /user/login          | bolmaker::Controller::User           |
login        |
'----------------------+--------------------------------------+--------------'

. . . 

Use of uninitialized value in string eq
at /home/col/charley/bolmaker/script/../lib/bolmaker/Controller/Root.pm
line 56. [info] 

Which is:
    if ($c->controller eq $c->controller('login')) {
        return 1;
    }

So, $c is undefined? That's bad. :(

*** Request 4 (0.010/s) [19336] [Tue Dec  4 07:01:50 2007] 
*** [debug] "GET" request for "user/login" from
"127.0.0.1" [debug] Arguments are "user/login" [debug] ***Root::auto
User not found, forwding to /login [debug] Redirecting to
"http://localhost:3000/user/login" [info] Request took 0.026145s
(38.248/s)

Anyway, if I could "easily" put this logic in one controller, what
would that look like?

I'm hoping that someone more Cat-aware will just have the trick, since
they've done this so many times before. ;-)

TIA

Cheers,

-- 
 |\  /|        |   |          ~ ~  
 | \/ |        |---|          `|` ?
 |    |ichael  |   |iggins    \^ /
 michael.higgins[at]evolone[dot]org



More information about the Catalyst mailing list