[Dbix-class] surprise with find_or_create
Marc Espie
espie at nerim.net
Thu May 24 14:49:23 GMT 2007
I've got a simple table schema:
package Artist;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/PK::Auto Core/);
__PACKAGE__->table('artist');
__PACKAGE__->add_columns(qw/ artistid name /);
__PACKAGE__->set_primary_key('artistid');
and I'm trying to copy an old database over.
I've got duplicates that differ a bit, which I'd like to unify.
So I tried the following:
my $rs = $db->resultset('Artist');
$rs->find_or_create({
name => {like => $oldname} });
the result is surprising: the new records end up having a HASH instead
of the old names...
I'm probably expecting too much magic from DBIx::Class...
More information about the Dbix-class
mailing list