[Catalyst] Trouble getting attribute parameters for action classes
    John Napiorkowski 
    jjn1056 at yahoo.com
       
    Thu Oct 12 18:19:41 CEST 2006
    
    
  
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?
I noticed that when I am writting plugins I have the
same sort of trouble, BTW.
Thanks!
John
__________________________________________________
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