[Catalyst] Insert Multiple rows - GOOD CODE

Matt S Trout dbix-class at trout.me.uk
Mon Dec 19 22:12:43 CET 2005


On Mon, Dec 19, 2005 at 12:57:02PM -0800, Will Smith wrote:
> thank you for your help. This is the code, and the error that I got. 
>    
>   foreach my $artist ( @{$c->req->params->{artistid}} ) {
>     my @test = $c->req->params('cdtitle');
>     if ($artist){
>      my $cd = mymusic::M::CDBI::Cd->find_or_create(
>       artistid => $artist
>      );
>     $cd->title(shift @{$c->req->params->{cdtitle}});
>     $cd->update();
> }}
> $c->stash->{template} = 'Cd/list.tt';
> }
>    
>   ----- the error message:
>   Caught exception "Can't use string ("cdtitle") as a HASH ref while "strict refs" in use.
>    
>   I guess that because of the declaration of the hash, but not sure how to fix that.

I'd recommend a copy of Learning Perl and a debugger.

-- 
     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/ +



More information about the Catalyst mailing list