X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBIHacks.pm;h=14410b700ddb47db9f593c7e811bb60773a12fef;hb=d52c4a75538bd15d1fa531a63c6ec45b8943dfd0;hp=c129b1e318b65af3b3c084e6424a55920f5a5ce5;hpb=07fadea8d16b657cc1ee572b8f64fa7a688be853;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index c129b1e..14410b7 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -1102,7 +1102,7 @@ sub _collapse_cond { for (sort keys %$chunk) { # Match SQLA 1.79 behavior - if ($_ eq '') { + unless( length $_ ) { is_literal_value($chunk->{$_}) ? carp 'Hash-pairs consisting of an empty string with a literal are deprecated, use -and => [ $literal ] instead' : $self->throw_exception("Supplying an empty left hand side argument is not supported in hash-pairs") @@ -1120,7 +1120,7 @@ sub _collapse_cond { # Match SQLA 1.79 behavior $self->throw_exception("Supplying an empty left hand side argument is not supported in array-pairs") - if $where_is_anded_array and (! defined $chunk or $chunk eq ''); + if $where_is_anded_array and (! defined $chunk or ! length $chunk); push @pairs, $chunk, shift @pieces; } @@ -1315,7 +1315,7 @@ sub _collapse_cond_unroll_pairs { while (@$pairs) { my ($lhs, $rhs) = splice @$pairs, 0, 2; - if ($lhs eq '') { + if (! length $lhs) { push @conds, $self->_collapse_cond($rhs); } elsif ( $lhs =~ /^\-and$/i ) {