Factor out dumper copy/paste
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase.pm
index 219ca56..bccd0b4 100644 (file)
@@ -696,18 +696,11 @@ EOF
       $self->throw_exception("Unexpected populate error: $err")
         if ($i > $#$tuple_status);
 
-      require Data::Dumper;
-      local $Data::Dumper::Terse = 1;
-      local $Data::Dumper::Indent = 1;
-      local $Data::Dumper::Useqq = 1;
-      local $Data::Dumper::Quotekeys = 0;
-      local $Data::Dumper::Sortkeys = 1;
-
       $self->throw_exception(sprintf "%s for populate slice:\n%s",
         ($tuple_status->[$i][1] || $err),
-        Data::Dumper::Dumper(
-          { map { $source_columns[$_] => $new_data[$i][$_] } (0 .. $#$cols) }
-        ),
+        $self->_pretty_print ({
+          map { $source_columns[$_] => $new_data[$i][$_] } (0 .. $#$cols)
+        }),
       );
     }
 
@@ -849,15 +842,11 @@ sub _insert_blobs {
     my $sth = $cursor->sth;
 
     if (not $sth) {
-      require Data::Dumper;
-      local $Data::Dumper::Terse = 1;
-      local $Data::Dumper::Indent = 1;
-      local $Data::Dumper::Useqq = 1;
-      local $Data::Dumper::Quotekeys = 0;
-      local $Data::Dumper::Sortkeys = 1;
-
-      croak "\nCould not find row in table '$table' for blob update:\n".
-        Data::Dumper::Dumper(\%where)."\n";
+
+      $self->throw_exception(
+          "Could not find row in table '$table' for blob update:\n"
+        . $self->_pretty_print (\%where)
+      );
     }
 
     eval {