Bring back constants excised in 08a8d8f1. FML.
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / _Util.pm
index 8c62054..09fdfe9 100644 (file)
@@ -52,6 +52,24 @@ BEGIN {
     require mro;
     constant->import( OLD_MRO => 0 );
   }
+
+  # Both of these are no longer used for anything. However bring
+  # them back after they were purged in 08a8d8f1, as there appear
+  # to be outfits with *COPY PASTED* pieces of lib/DBIx/Class/Storage/*
+  # in their production codebases. There is no point in breaking these
+  # if whatever they used actually continues to work
+  my $warned;
+  my $sigh = sub {
+
+    require Carp;
+    my $cluck = "The @{[ (caller(1))[3] ]} constant is no more - adjust your code" . Carp::longmess();
+
+    warn $cluck unless $warned->{$cluck}++;
+
+    0;
+  };
+  sub DBICTEST () { &$sigh }
+  sub PEEPEENESS () { &$sigh }
 }
 
 # FIXME - this is not supposed to be here
@@ -75,7 +93,7 @@ our @EXPORT_OK = qw(
   refdesc refcount hrefaddr
   scope_guard detected_reinvoked_destructor
   is_exception dbic_internal_try
-  quote_sub qsub perlstring serialize deep_clone
+  quote_sub qsub perlstring serialize deep_clone dump_value
   parent_dir mkdir_p
   UNRESOLVABLE_CONDITION
 );
@@ -121,6 +139,42 @@ sub serialize ($) {
   nfreeze($_[0]);
 }
 
+my $dd_obj;
+sub dump_value ($) {
+  local $Data::Dumper::Indent = 1
+    unless defined $Data::Dumper::Indent;
+
+  my $dump_str = (
+    $dd_obj
+      ||=
+    do {
+      require Data::Dumper;
+      my $d = Data::Dumper->new([])
+        ->Purity(0)
+        ->Pad('')
+        ->Useqq(1)
+        ->Terse(1)
+        ->Freezer('')
+        ->Quotekeys(0)
+        ->Bless('bless')
+        ->Pair(' => ')
+        ->Sortkeys(1)
+        ->Deparse(1)
+      ;
+
+      $d->Sparseseen(1) if modver_gt_or_eq (
+        'Data::Dumper', '2.136'
+      );
+
+      $d;
+    }
+  )->Values([$_[0]])->Dump;
+
+  $dd_obj->Reset->Values([]);
+
+  $dump_str;
+}
+
 sub scope_guard (&) {
   croak 'Calling scope_guard() in void context makes no sense'
     if ! defined wantarray;