From: Peter Rabbitson Date: Tue, 15 Sep 2009 04:54:36 +0000 (+0000) Subject: Fix some warnings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bd6a65cac4599702fc4a717772934ff28421c6be;p=scpubgit%2FQ-Branch.git Fix some warnings --- diff --git a/Changes b/Changes index 750d35e..ea6cca4 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for SQL::Abstract + - Fixed a couple of untrapped undefined warnings + revision 1.58 2009-09-04 15:20 (UTC) ---------------------------- - expanded the scope of -bool and -not_bool operators diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index d2960a1..532d70a 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -708,11 +708,14 @@ sub _where_field_op_ARRAYREF { my @vals = @$vals; #always work on a copy if(@vals) { - $self->_debug("ARRAY($vals) means multiple elements: [ @vals ]"); + $self->_debug(sprintf '%s means multiple elements: [ %s ]', + $vals, + join (', ', map { defined $_ ? "'$_'" : 'NULL' } @vals ), + ); # see if the first element is an -and/-or op my $logic; - if ($vals[0] =~ /^ - ( AND|OR ) $/ix) { + if (defined $vals[0] && $vals[0] =~ /^ - ( AND|OR ) $/ix) { $logic = uc $1; shift @vals; } diff --git a/t/02where.t b/t/02where.t index 9d22beb..6fe91f8 100644 --- a/t/02where.t +++ b/t/02where.t @@ -117,6 +117,14 @@ my @handle_tests = ( { where => { + requestor => { '!=', ['-and', undef, ''] }, + }, + stmt => " WHERE ( requestor IS NOT NULL AND requestor != ? )", + bind => [''], + }, + + { + where => { priority => [ {'>', 3}, {'<', 1} ], requestor => { '!=', undef }, },