[Catalyst] using Authentication plugin
Yuval Kogman
nothingmuch at woobling.org
Tue Jan 24 23:50:08 CET 2006
On Mon, Jan 23, 2006 at 17:00:26 -0800, Hang Sun wrote:
> Hi, I try to use the Authentication plugin by following the instruction. my code looks like: =====package myapp; use strict;use warnings; use Catalyst qw/-Debug Authentication Authentication::Store::Minimal Authentication::Credential::Password /; ## Set flags and add plugins for the application## -Debug: activates the debug mode for very useful log messages# Static::Simple: will serve static files from the applications root directory#use Catalyst qw/-Debug Static::Simple/; our $VERSION = '0.01'; ## Configure the application#__PACKAGE__->config->{name} = 'plmessenger'; __PACKAGE__->config->{authentication}{users} = { userx => { password => "userx", roles => [qw/admin/], },}; ## Start the application#__PACKAGE__->setup; ## Output a friendly welcome message#sub default : Private { my ( $self, $c ) = @_; $c->response->body( $c->welcome_message );} sub login : Global { my ( $self, $c ) = @_; $c->login( 'userx', 'userx' );} 1;====== But the result complains: Caught exception "Can't locate object method "login" via package "myapp" at C:/site/myapp/lib/myapp.pm line xxx." Do I miss anything in configuration? Thanks
Please try to use a better email client - this is very hard to read
with the line breaks stripped, curtesy of:
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Anyway, to your problem:
first of all, there's a bit of a confusion. Since $c's class is
'myapp' then 'sub login : Global' will override the plugin method.
You need to put 'sub login : Global' in another controller if you
want it to work right, and keep that action name.
WRT the 'can't locate object method "login" via package "myapp" -
that makes no sense, based on your code. Are you poissibly missing
somerthing? Can you paste line xxx?
--
() Yuval Kogman <nothingmuch at woobling.org> 0xEBD27418 perl hacker &
/\ kung foo master: /me groks YAML like the grasshopper: neeyah!!!!!!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060125/d685b452/attachment.pgp
More information about the Catalyst
mailing list