[Catalyst] Submitting Multiple Arrays
    Carl Franks 
    fireartist at gmail.com
       
    Thu Jan 31 07:31:43 GMT 2008
    
    
  
I don't know if it'll solve all your problems, but this is definitely wrong:
>         my @articles = $c->request->params->{article_id};
> ...
>         foreach my $article ( @articles ) {
You're assigning an arrayref to the first item in @articles.
Do this instead:
    my $articles = $c->request->params->{article_id};
    # if there was only 1 article_id submitted, it won't be an arrayref
    # make sure it's an arrayref, so the loop below doesn't break
    $articles = [$articles] if ref $articles ne 'ARRAY';
    # dereference the arrayref
    for my $id (@$articles) { ... }
Carl
    
    
More information about the Catalyst
mailing list