Lose yet another dep (Data::Dumper::Concise)
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBIHacks.pm
index c129b1e..e98bc49 100644 (file)
@@ -30,7 +30,7 @@ use mro 'c3';
 
 use List::Util 'first';
 use Scalar::Util 'blessed';
-use DBIx::Class::_Util qw(UNRESOLVABLE_CONDITION serialize);
+use DBIx::Class::_Util qw(UNRESOLVABLE_CONDITION serialize dump_value);
 use SQL::Abstract qw(is_plain_value is_literal_value);
 use DBIx::Class::Carp;
 use namespace::clean;
@@ -513,9 +513,9 @@ sub _resolve_aliastypes_from_select_args {
   ( $_ = join ' ', map {
 
     ( ! defined $_ )  ? ()
-  : ( length ref $_ ) ? (require Data::Dumper::Concise && $self->throw_exception(
-                          "Unexpected ref in scan-plan: " . Data::Dumper::Concise::Dumper($_)
-                        ))
+  : ( length ref $_ ) ? $self->throw_exception(
+                          "Unexpected ref in scan-plan: " . dump_value $_
+                        )
   : ( $_ =~ /^\s*$/ ) ? ()
                       : $_
 
@@ -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 ) {
@@ -1346,11 +1346,10 @@ sub _collapse_cond_unroll_pairs {
 
             # extra sanity check
             if (keys %$p > 1) {
-              require Data::Dumper::Concise;
               local $Data::Dumper::Deepcopy = 1;
               $self->throw_exception(
                 "Internal error: unexpected collapse unroll:"
-              . Data::Dumper::Concise::Dumper { in => { $lhs => $rhs }, out => $p }
+              . dump_value { in => { $lhs => $rhs }, out => $p }
               );
             }