$call_cond = shift;
}
# fish out attrs in the ($condref, $attr) case
- elsif (@_ == 2 and ( ! defined $_[0] or (ref $_[0]) ne '') ) {
+ elsif (@_ == 2 and ( ! defined $_[0] or length ref $_[0] ) ) {
($call_cond, $call_attrs) = @_;
}
elsif (@_ % 2) {
for my $i (0 .. $#_) {
next if $i % 2;
$self->throw_exception ('All keys in condition key/value pairs must be plain scalars')
- if (! defined $_[$i] or ref $_[$i] ne '');
+ if (! defined $_[$i] or length ref $_[$i] );
}
$call_cond = { @_ };
}
else {
$fields->{$col} = \"''";
- $blob_cols{$col} = $blob_val unless $blob_val eq '';
+ $blob_cols{$col} = $blob_val
+ if length $blob_val;
}
}
}
else {
$data->[$j][$i] = \"''";
$blob_cols[$j][$i] = $blob_val
- unless $blob_val eq '';
+ if length $blob_val;
}
}
}
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")
# 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;
}
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 ) {
# There got to be a saner way of doing this...
if (is_exception $@) {
weaken(
- $guard->{existing_exception_ref} = (ref($@) eq '') ? \$@ : $@
+ $guard->{existing_exception_ref} = (length ref $@) ? $@ : \$@
);
}
(
! defined $self->{existing_exception_ref}
or
- refaddr( ref($@) eq '' ? \$@ : $@ ) != refaddr($self->{existing_exception_ref})
+ refaddr( (length ref $@) ? $@ : \$@ ) != refaddr($self->{existing_exception_ref})
)
);
{
local $@;
eval {
- $not_blank = ($e ne '') ? 1 : 0;
+ # The ne() here is deliberate - a plain length($e), or worse "$e" ne
+ # will entirely obviate the need for the encolsing eval{}, as the
+ # condition we guard against is a missing fallback overload
+ $not_blank = ( $e ne '' );
1;
} or $suberror = $@;
}
));
# workaround, keeps spice flowing
- $not_blank = ("$e" ne '') ? 1 : 0;
+ $not_blank = !!( length $e );
}
else {
# not blessed yet failed the 'ne'... this makes 0 sense...