[Catalyst] Create multiple records
Hermida, Leandro
Leandro.Hermida at fmi.ch
Tue Jan 2 16:24:20 GMT 2007
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:willbelair at yahoo.com]
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070102/e21ea619/attachment-0001.htm
More information about the Catalyst
mailing list