[Dbix-class] DBIx::Class::Resultset - DBI Exception near PATH

onken at houseofdesign.de onken at houseofdesign.de
Tue Feb 17 13:11:30 GMT 2009


On Tue, 17 Feb 2009 13:00:04 +0000, Dermot <paikkos at googlemail.com> wrote:
> Hi,
> 
> I have a  hashref like so:
> 
>           {
>             'file' => 'cheese-biscuits_cutout_12-10-08_1.jpg',
>             'path' => '/data/scanning/fast_track/ydm/12-10-08_1.jpg',
>             'user_reference' => '12-10-08_1',
>             'keywords' => 'Cheese biscuits, biscuits, biscuit, stack,
> baked goods, cut out, white',
>             'caption' => 'Cheese biscuits',
>             'title' => 'Cheese biscuits'
>           },
> 
> 
> That I am trying to INSERT with find_or_create like this
> 
>   my $row = $schema->resultset('MetaData')->find_or_create({
>         id                      => undef,
>         title                   => $hashref->{'title'},
>         keywords                => $hashref->{'keywords'},
>         caption                 => $hashref->{'caption'},,
>         users_reference  => $hashref->{'users_reference'},
>         file                    => [ { path => $hashref->{'path'} } ], #
>         has_one
>   });
> 
> 

$hashref->{'users_reference'} does nox exist. I had problems with undef
variables in a hash. I generally put a "scalar" in front of my variables,
this fixes the "undef value in hash"-problem


e.g.

->find_or_create({
...
users_reference  => scalar $hashref->{'users_reference'},
...
});



More information about the DBIx-Class mailing list