More robust insert() logic to avoid undef warnings
Peter Rabbitson [Thu, 9 Jun 2011 09:32:43 +0000 (11:32 +0200)]
lib/DBIx/Class/Row.pm

index ea6ea09..4eaa431 100644 (file)
@@ -357,9 +357,11 @@ sub insert {
       # this ensures we fire store_column only once
       # (some asshats like overriding it)
       if (
-        (! defined $current_rowdata{$_})
+        (!exists $current_rowdata{$_})
           or
-        ( $current_rowdata{$_} ne $returned_cols->{$_})
+        (defined $current_rowdata{$_} xor defined $returned_cols->{$_})
+          or
+        (defined $current_rowdata{$_} and $current_rowdata{$_} ne $returned_cols->{$_})
       );
   }