oops, that a typo, sorry, I fixed that one. I realized it right after I sent
the mail. The problem is it does not loop through the html page. this is what i
done, and just the first value got inserted:
my @records;
my $book;
foreach ( $book = (shift @{$c->request->params->{book}})){
push @records, {title => $book};
};
if, i try to put a second params, it just do nothing;
push @records, {title => $book, price => $c->request->params->{price}};
"Hermida, Leandro" <[EMAIL PROTECTED]> wrote: Where did you declare
@records? I can't see that in your code below but "my $record" could have
been a typo and should read "my @records". You get that error in Perl when
you try to use a variable that is not declared (under use strict;) or the
declared variable is then used outside of its lexical scope.
Leandro
---------------------------------
From: Will Smith [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 02, 2007 16:54
To: The elegant MVC web framework
Subject: Re: [Catalyst] Create multiple records
happy new year to all of you.
thanks all for your support. Back to the question, (which I guess, will
irritate some catalyst/perl gurus - but please be patient for learners),
I've been able to add multiple records with "PRE" assigned values. But
that's not my purpose. I need to add multiple rows that have the same name
on the html. I tried several ways, but none was good.
my $book;
my $record;
foreach $book ( @{$c->request->params->{book}}){
push @records, {title => $book, price => $price };
};
eval{
$c->model('bookDB::Book')->create($_) foreach (@records);
};
---- this gives me the compling error: Global symbol "@records" requires
explicit package name
_______________________________________________
List: [email protected]
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 _______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/