require Exporter;
require Data::Dumper;
+use Scalar::Util 'isweak';
BEGIN { @ISA = qw(Exporter) }
$dd->Terse(1)->Indent(1)->Useqq(1)->Deparse(1)->Quotekeys(0)->Sortkeys(1);
}
-sub Dumper { DumperObject->Values([ @_ ])->Dump }
+sub Dumper {
+ my $o = Data::Dumper->can('_dump');
+ local *Data::Dumper::_dump = sub {
+ isweak($_[1])
+ ? 'do { WEAK: ' . $o->(@_) . ' }'
+ : $o->(@_)
+ };
+ DumperObject->Values([ @_ ])->Dump
+}
sub DumperF (&@) {
my $code = shift;
use Data::Dumper ();
use Data::Dumper::Concise;
use Test::More qw(no_plan);
+use Scalar::Util 'weaken';
my $dd = Data::Dumper->new([])
->Terse(1)
}
my $out = DumperF { "arr: $_[0] str: $_[1]" } [qw(wut HALP)], "gnarl";
-
+my $x = [1, 2];
+my $z = $x;
+my $y = weaken($x);
+warn Dumper($y);
+warn Dumper($x);
is($out, qq{arr: [\n "wut",\n "HALP"\n]\n str: "gnarl"\n}, 'DumperF works!');