X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-DBIx-Class-ResultSet-RecursiveUpdate;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSet%2FRecursiveUpdate.pm;h=ebb29f26c8d6ba3f6cfb6c3bf76e14665d4d1114;hp=20158603eb191e82e672e138c2e2c20bd0aec591;hb=94b45cc97e1539467d537de1c64466e68dc50de9;hpb=836cf9832dc52973f698b000d7df8604c0b0d342 diff --git a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm index 2015860..ebb29f2 100644 --- a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm +++ b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm @@ -37,6 +37,7 @@ package DBIx::Class::ResultSet::RecursiveUpdate::Functions; use Carp::Clan qw/^DBIx::Class|^HTML::FormHandler|^Try::Tiny/; use Scalar::Util qw( blessed ); use List::MoreUtils qw/ any /; +use Try::Tiny; sub recursive_update { my %params = @_; @@ -86,14 +87,18 @@ sub recursive_update { if ( !defined $object && scalar @missing == 0 ) { # warn 'finding by: ' . Dumper( $updates ); use Data::Dumper; - $object = $self->find( $updates, { key => 'primary' } ); + try { + $object = $self->find( $updates, { key => 'primary' } ); + }; } $updates = { %$updates, %$resolved }; @missing = grep { !exists $resolved->{$_} } @missing; if ( !defined $object && scalar @missing == 0 ) { - # warn 'finding by +resolved: ' . Dumper( $updates ); use Data::Dumper; - $object = $self->find( $updates, { key => 'primary' } ); + # warn 'finding by +resolved: ' . Dumper( $updates ); use Data::Dumper; + try { + $object = $self->find( $updates, { key => 'primary' } ); + }; } $object = $self->new( {} )