X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRow.pm;h=85a05512772773e8dd001e1ca4bc99262cb4872d;hb=534ca143a55e39ba76b29d63aa3a9f8f8477bc11;hp=0837ba87eca5efe84236ddb6a22cdb94e6258c66;hpb=aeb1bf757122d5260a1d84f17f2d0beec7822165;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index 0837ba8..85a0551 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -318,7 +318,7 @@ sub inflate_result { $pre_source, @{$pre_rec})); } $new->related_resultset($pre)->set_cache(\@pre_objects); - } else { + } elsif (defined $pre_val->[0]) { my $fetched; unless ($pre_source->primary_columns == grep { exists $pre_val->[0]{$_} and !defined $pre_val->[0]{$_} } $pre_source->primary_columns) @@ -341,15 +341,16 @@ sub inflate_result { return $new; } -=head2 insert_or_update +=head2 update_or_insert - $obj->insert_or_update + $obj->update_or_insert Updates the object if it's already in the db, else inserts it. =cut -sub insert_or_update { +*insert_or_update = \&update_or_insert; +sub update_or_insert { my $self = shift; return ($self->in_storage ? $self->update : $self->insert); }