[Dbix-class] CDBICompat NumExplodingSheep
Peter Rabbitson
rabbit+dbic at rabbit.us
Tue Feb 3 09:11:35 GMT 2009
Dave Howorth wrote:
> I wrote:
>> I think there are some problems in test t/cdbi-t/15-accessor-new.t
> ...
>> I also think there's a problem with find_or_create() and accessor_for().
>> For starters there're no tests! But I haven't yet got a set of tests for
>> which I understand the results and which agree with the failure I'm
>> seeing in my application. They're similar to the one for search() I'll
>> post some tests when I have them.
>
Hi Dave,
I contacted the CDBI-compat shim maintainer and here is his reply. I also included
him in the CC, please reply-all if you discuss it with him to keep me in the loop.
==============================================================
Peter Rabbitson wrote:
> Haven't seen you on IRC for a while, figured I'll try here. We got a
> bugreport[1] against the compat layer some time ago. I applied his
> indeed failing tests[2], and TODOified[3] them. If you can drop by to see
> if this can/needs to be fixed it'd be great.
In general, I think you're right to do the full hash copy.
But I ran the new tests through CDBI and insert() doesn't appear to honor
accessor_name_for() for the hash keys. So this sort of thing doesn't work.
eval {
my $data = { %$data };
$data->{sheep} = 2;
ok my $bt = Film->insert($data), "Modified accessor - with accessor";
isa_ok $bt, "Film";
is $bt->sheep, 2, 'sheep bursting violently';
};
is $@, '', "No errors";
Whether this is a bug or feature of CDBI is arguable, insert() and the
accessors have always been a little out of sync, but as far as CDBI::Compat is
concerned just go with what CDBI actually does.
So those new tests should probably be pulled.
More information about the DBIx-Class
mailing list