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

Matt S Trout dbix-class at trout.me.uk
Thu Jan 11 18:04:02 GMT 2007


On 8 Jan 2007, at 23:55, 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') );

This should be

$c->user->obj->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 at lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

-- 
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for  
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for  
details.
+ Help us build a better perl ORM: http://dbix- 
class.shadowcatsystems.co.uk/ +





More information about the Catalyst mailing list