Subject: | broken DBIx::Class::Row is_changed object method |
If row has modified columns, is_changed method returns true.
But if row has no changes, is_changed dies. I've found bug, patch was
attached.
Subject: | is_changed.patch |
diff -ru DBIx-Class-FrozenColumns-0.08/lib/DBIx/Class/FrozenColumns.pm DBIx-Class-FrozenColumns-0.09/lib/DBIx/Class/FrozenColumns.pm
--- DBIx-Class-FrozenColumns-0.08/lib/DBIx/Class/FrozenColumns.pm 2009-07-01 11:09:00.000000000 +0400
+++ DBIx-Class-FrozenColumns-0.09/lib/DBIx/Class/FrozenColumns.pm 2010-01-11 19:02:40.000000000 +0300
@@ -4,7 +4,7 @@
use strict;
use warnings;
-our $VERSION = 0.08;
+our $VERSION = 0.09;
__PACKAGE__->mk_group_accessors(inherited => qw/_frozen_columns _dirty_frozen_columns/);
__PACKAGE__->_frozen_columns({});
@@ -353,7 +353,7 @@
return @columns;
}
- return 1 if $self->next::method(@_) or keys %{$self->_dirty_frozen_columns};
+ return 1 if $self->next::method(@_) or keys %{$self->_dirty_frozen_columns||{}};
}
=head2 update
diff -ru DBIx-Class-FrozenColumns-0.08/t/05frozen.t DBIx-Class-FrozenColumns-0.09/t/05frozen.t
--- DBIx-Class-FrozenColumns-0.08/t/05frozen.t 2009-07-01 11:05:43.000000000 +0400
+++ DBIx-Class-FrozenColumns-0.09/t/05frozen.t 2010-01-11 19:01:28.000000000 +0300
@@ -5,7 +5,7 @@
use lib 't/lib';
use FrozenTest;
-plan tests => 25;
+plan tests => 27;
my $schema = FrozenTest->init;
my $rs = $schema->resultset('Source');
@@ -22,8 +22,9 @@
$row->$acc("acc_$t");
is $row->$acc, "acc_$t", "$t: accessor";
}
-
+ok $row->is_changed;
$row->update;
+ok !$row->is_changed;
$row = $rs->find({id => $id});
$rs->create({
id => ++$id,