[Catalyst] Trouble getting attribute parameters for action classes

John Napiorkowski jjn1056 at yahoo.com
Thu Oct 12 20:47:05 CEST 2006



--- Matt S Trout <dbix-class at trout.me.uk> wrote:

> John Napiorkowski wrote:
> > Hi,
> > 
> > I'm working on an action class and trying to
> > understand how parameters are passed into
> attributes.
> > 
> > If I call an action class like this:
> > 
> > sub test :Local ActionClass('test') myAttr() {}
> > 
> > in the action class match I can check for that
> custom
> > attribute like so:
> > 
> > sub match
> > {
> >   my $self = shift @_;
> >   my ($c)  = @_;
> > 
> >   return 1 unless exists
> $self->attributes->{myAttr};
> > 
> >   my @params = @{$self->attributes->{myAttr}};
> > 
> >   ...
> > }
> > 
> > However no matter what I use for attribute
> parameters
> > that @params always has a single entry.  I figure
> I
> > must be doing something wrong because if the
> attribute
> > is only allowed to have a single parameter why
> bother
> > to have it in an array ref?
> > 
> > I've tried:
> > 
> > myAttr(a,b,c)
> > myAttr('a','b','c')
> > myAttr(qw/a b c/)
> > 
> > but the @params from the example above always ends
> up
> > having:
> > 
> > $params[0] = "a,b,c";
> > $params[0] = "a','b','c";
> > $params[0] = "qw/a b c/";
> > 
> > and the like.
> > 
> > Does anyone know what I am doing incorrectly?
> 
> sub foo :myAttr(a) :myAttr(b) :myAttr(c)

Thank you. --john

> 
> -- 
>       Matt S Trout       Offering custom
> development, consultancy and support
>    Technical Director    contracts for Catalyst,
> DBIx::Class and BAST. Contact
> Shadowcat Systems Ltd.  mst (at)
> shadowcatsystems.co.uk for more information
> 
> + Help us build a better perl ORM:
> http://dbix-class.shadowcatsystems.co.uk/ +
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Catalyst mailing list