http://www.perlmonks.org?node_id=532496

ColtsFoot has asked for the wisdom of the Perl Monks concerning the following question:

I am following Marcus Ramberg's Catalyst Tutorial on CPAN
and get the following error when implementing the login action
Caught exception in tutorial::Controller::Users->logon "Can't locate o +bject method "login" via package "tutorial" at /home/bric1/tutorial/s +cript/../lib/tutorial/Controller/Users.pm line 24."
I have the following "use" statements
use Catalyst qw/-Debug Static::Simple Authentication Authentication::Store::Minimal Authentication::Credential::Password/;
My login action code is as follows
sub login : Local { my ($self, $c) = @_; $c->stash->{template} = 'userlogin.tt'; if(!$c->login()) { $c->stash->{message} = 'Please login.'; } else { $c->stash->{message} = "Welcome " . $c->user->id; } }
Authentication::Credential::Password does have a "login" method
I would be gratefil for any pointers

Replies are listed 'Best First'.
Re: Problem with Catalyst Tutorial
by castaway (Parson) on Feb 24, 2006 at 09:14 UTC
    Do you have that login sub in your tutorial.pm, or in a controller? (It should be in a controller) And is the "use Catalyst" in your tutorial.pm (It should be)? Do you get a Credential::Password listed in the list of loaded plugins when you start the test server?

    Also note that your error message says "logon" and your code says "login" which is it?

    C.

Re: Problem with Catalyst Tutorial
by ghenry (Vicar) on Feb 24, 2006 at 11:23 UTC

    Check out some of the Example Apps and read some of the Advent calender. It's all there ;-)

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a yourname@perl.me.uk? Just ask!!!