From: Michael G Schwern Date: Thu, 14 Feb 2008 07:43:24 +0000 (-0800) Subject: Put the stringification back, older versions of DateTime string equality are X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3672b17f012174552f95a7a29a3b976855492279;p=dbsrgits%2FDBIx-Class-Historic.git Put the stringification back, older versions of DateTime string equality are still broken. But don't bother to stringify anything that's not a reference. --- diff --git a/lib/DBIx/Class/CDBICompat/GetSet.pm b/lib/DBIx/Class/CDBICompat/GetSet.pm index 80e941f..dd621f2 100644 --- a/lib/DBIx/Class/CDBICompat/GetSet.pm +++ b/lib/DBIx/Class/CDBICompat/GetSet.pm @@ -17,6 +17,15 @@ sub get { sub set { my($self, %data) = @_; + + # set_columns() is going to do a string comparison before setting. + # This breaks on DateTime objects (whose comparison is arguably broken) + # so we stringify anything first. + for my $key (keys %data) { + next unless ref $data{$key}; + $data{$key} = "$data{$key}"; + } + return shift->set_columns(\%data); }