sub find {
my $self = shift;
- my $attrs = (@_ > 1 && ref $_[$#_] eq 'HASH' ? pop(@_) : {});
+ my $attrs = (@_ > 1 && ref $_[-1] eq 'HASH' ? pop(@_) : {});
my $rsrc = $self->result_source;
my $relinfo = $rsrc->relationship_info($key)
and
# implicitly skip has_many's (likely MC)
- (ref (my $val = delete $call_cond->{$key}) ne 'ARRAY' )
+ ( ref( my $val = delete $call_cond->{$key} ) ne 'ARRAY' )
) {
my ($rel_cond, $crosstable) = $rsrc->_resolve_condition(
$relinfo->{cond}, $val, $key, $key
.' Instead use ->search({ x => { -like => "y%" } })'
.' (note the outer pair of {}s - they are important!)'
);
- my $attrs = (@_ > 1 && ref $_[$#_] eq 'HASH' ? pop(@_) : {});
+ my $attrs = (@_ > 1 && ref $_[-1] eq 'HASH' ? pop(@_) : {});
my $query = ref $_[0] eq 'HASH' ? { %{shift()} }: {@_};
$query->{$_} = { 'like' => $query->{$_} } for keys %$query;
return $class->search($query, { %$attrs });
sub find_or_new {
my $self = shift;
- my $attrs = (@_ > 1 && ref $_[$#_] eq 'HASH' ? pop(@_) : {});
+ my $attrs = (@_ > 1 && ref $_[-1] eq 'HASH' ? pop(@_) : {});
my $hash = ref $_[0] eq 'HASH' ? shift : {@_};
if (keys %$hash and my $row = $self->find($hash, $attrs) ) {
return $row;
sub find_or_create {
my $self = shift;
- my $attrs = (@_ > 1 && ref $_[$#_] eq 'HASH' ? pop(@_) : {});
+ my $attrs = (@_ > 1 && ref $_[-1] eq 'HASH' ? pop(@_) : {});
my $hash = ref $_[0] eq 'HASH' ? shift : {@_};
if (keys %$hash and my $row = $self->find($hash, $attrs) ) {
return $row;
sub update_or_create {
my $self = shift;
- my $attrs = (@_ > 1 && ref $_[$#_] eq 'HASH' ? pop(@_) : {});
+ my $attrs = (@_ > 1 && ref $_[-1] eq 'HASH' ? pop(@_) : {});
my $cond = ref $_[0] eq 'HASH' ? shift : {@_};
my $row = $self->find($cond, $attrs);
sub update_or_new {
my $self = shift;
- my $attrs = ( @_ > 1 && ref $_[$#_] eq 'HASH' ? pop(@_) : {} );
+ my $attrs = ( @_ > 1 && ref $_[-1] eq 'HASH' ? pop(@_) : {} );
my $cond = ref $_[0] eq 'HASH' ? shift : {@_};
my $row = $self->find( $cond, $attrs );
#
# Some of the methods defined here will be around()-ed by code at the
# end of ::ResultSourceProxy. The reason for this strange arrangement
-# is that the list of around()s of methods in this # class depends
+# is that the list of around()s of methods in this class depends
# directly on the list of may-not-be-defined-yet methods within
# ::ResultSourceProxy itself.
# If this sounds terrible - it is. But got to work with what we have.