[Catalyst] Not getting passed arguments in $c->user methods

Steve Cayford cayfo001 at umn.edu
Wed Jan 10 19:51:43 GMT 2007


Can anyone comment on this? Is this a bug? Am I doing something wrong?
Do you need more information? It certainly appears that something in
Catalyst is stripping off the arguments to the method before passing the
call along to my code.

-Steve

Steve Cayford wrote:
> Hi,
> 
> I'm fairly new with Catalyst, so please forgive me if this is obvious.
> 
> I'm using a DBIx::Class "Person" class for the authentication store.
> I've extended this Person class using a custom component. (This is
> running on mod_perl 1.29 and Apache 1.3.33 on Debian stable.)
> 
> That all works well enough, I can access the class and its methods via
> $c->user. However, the methods are not getting any arguments other than
> $self.
> 
> In a catalyst action I tried this code:
> 
> -------
> 
> $c->log->info( $c->user->return_arg('first') );
> 
> my $user_obj
>     = $c->model('MacWebDB::Person')->find( $c->user->person_id() );
> 
> $c->log->info( $user_obj->return_arg('second') );
> 
> -------
> 
> where the return_arg method is added to Person via a component:
> 
> -------
> 
> package UMN::MAC::DBIx::Person;
> use base qw( DBIx::Class );
> 
> __PACKAGE__->load_components( qw( Person_Component PK::Auto Core ) );
> 
> [...]
> 
> package DBIx::Class::Person_Component;
> use base qw( DBIx::Class );
> 
> sub return_arg {
>     my ($self, $arg) = @_;
>     return "arg: $arg";
> }
> 
> 1;
> 
> -------
> 
> Then in the log, I find this:
> 
> [info] arg:
> [info] arg: second
> 
> So in both calls, I'm getting the correct method, but only the second
> version receives any arguments.
> 
> I'm using the following plugins:
> 
> use Catalyst  qw/
>                     -Debug
>                     ConfigLoader
>                     Static::Simple
> 
>                     Email
> 
>                     HTML::Widget
> 
>                     Session
>                     Session::Store::FastMmap
>                     Session::State::Cookie
> 
>                     Authentication
>                     Authentication::Store::DBIC
>                     Authentication::Credential::Password
> 
>                     Authorization::Roles
> 
>                 /
>     ;
> 
> Thanks for any suggestions.
> 
> -Steve
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/


-- 

Steven Cayford
McNamara Academic Center
University of Minnesota
http://gopheracademics.com



More information about the Catalyst mailing list