From: Justin Hunter <justin.d.hunter@gmail.com>
Date: Tue, 28 Apr 2009 06:45:31 +0000 (+0000)
Subject: patch to suppress warnings in case first element of the arrayref is undef (NULL)
X-Git-Tag: v1.70~175
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e3cecb459d742a51bad41ce7d5285f2d30df6dc0;p=dbsrgits%2FSQL-Abstract.git

patch to suppress warnings in case first element of the arrayref is undef (NULL)
---

diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm
index 5c5c32c..3828802 100644
--- a/lib/SQL/Abstract.pm
+++ b/lib/SQL/Abstract.pm
@@ -505,9 +505,10 @@ sub _where_hashpair_ARRAYREF {
     $self->_debug("ARRAY($k) means distribute over elements");
 
     # put apart first element if it is an operator (-and, -or)
-    my $op = ($v[0] =~ /^ - (?: AND|OR ) $/ix
-      ? shift @v
-      : ''
+    my $op = (
+       (defined $v[0] && $v[0] =~ /^ - (?: AND|OR ) $/ix)
+         ? shift @v
+         : ''
     );
     my @distributed = map { {$k =>  $_} } @v;