From: Peter Rabbitson Date: Sun, 7 Sep 2014 11:11:30 +0000 (+0200) Subject: Simplify self_result_object argument check in cond resolver X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d758a250031618a2b0f50aaf5edf8dfb81efd918;p=dbsrgits%2FDBIx-Class-Historic.git Simplify self_result_object argument check in cond resolver --- diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 0636f2e..d046875 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -1881,13 +1881,13 @@ sub _resolve_relationship_condition { $args->{condition} ||= $rel_info->{cond}; - if (exists $args->{self_result_object}) { - $self->throw_exception( "Argument 'self_result_object' must be an object of class '@{[ $self->result_class ]}'" ) - unless defined blessed $args->{self_result_object}; - - $self->throw_exception( "Object '$args->{self_result_object}' must be of class '@{[ $self->result_class ]}'" ) - unless $args->{self_result_object}->isa($self->result_class); - } + $self->throw_exception( "Argument 'self_result_object' must be an object of class '@{[ $self->result_class ]}'" ) + if ( + exists $args->{self_result_object} + and + ( ! defined blessed $args->{self_result_object} or ! $args->{self_result_object}->isa($self->result_class) ) + ) + ; my $rel_rsrc = $self->related_source($args->{rel_name});