Data-Dumper-Limited

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

sv_pvutf8n_force||5.006000|
sv_pvutf8n||5.006000|
sv_pvutf8||5.006000|
sv_pv||5.006000|
sv_recode_to_utf8||5.007003|
sv_reftype|||
sv_release_COW|||
sv_replace|||
sv_report_used|||
sv_reset|||
sv_rvweaken||5.006000|
sv_setiv_mg|5.004050||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||
sv_setpv_mg|5.004050||p
sv_setpvf_mg_nocontext|||pvn
sv_setpvf_mg|5.006000|5.004000|pv
sv_setpvf_nocontext|||vn
sv_setpvf||5.004000|v
sv_setpviv_mg||5.008001|

t/002_basic.t  view on Meta::CPAN

#!perl
use strict;
use warnings;
use Data::Dumper::Limited qw(DumpLimited);
use Data::Dumper;
use Scalar::Util qw(weaken);
use Test::More;
*qquote= \&Data::Dumper::qquote;
# silly thing, but tests that it doesn't crash and burn
is(DumpLimited(undef), "undef");

is(DumpLimited(1), "1", "integer");
is(DumpLimited(-1), "-1", "negative int");
is(DumpLimited(2), "2", "integer (2)");
is(DumpLimited(2e10), "2". ("0" x 10), "large integer");
is(DumpLimited(99999.9881), "99999.9881", "float");

t/002_basic.t  view on Meta::CPAN

undef $r->[0];

$r = [[[\$r]]];
ok(not(eval {DumpLimited($r); 1}) && $@, "deep cyclic refs barf");
undef $r->[0];

$x = [];
$r = [$x, $x];
is(DumpLimited($r), "[[],[]]", "multiple identical refs (2)");

weaken($r->[1]);
is(DumpLimited($r), "[[],[]]", "multiple identical refs (2)");

$r = [[\$r, \$r]];
weaken($r->[0][0]);
ok(not(eval {DumpLimited($r); 1}) && $@, "deep cyclic refs barf, even with weakrefs: $@");
undef $r->[0];

$r = [$x, $x];
ok(not(eval {DumpLimited($r, {disallow_multi => 1}); 1}) && $@, "non-cyclic, repeated refs barf under disallow_multi");

is(DumpLimited(bless({a => "b"} => "Foo"), {dump_objects => 1}), "bless({'a','b'},'Foo')", "Simple hashref object");


done_testing();

t/100_roundtrip.t  view on Meta::CPAN

#!perl
use strict;
use warnings;
use Data::Dumper::Limited qw(DumpLimited);
use Scalar::Util qw(weaken);
use Data::Undump qw(undump);

use Test::More;

my $aryref = [{foo => 'bar'}, 2, "asd"];
my $latin1= "Ba\xDF";
my $uni= $latin1;
utf8::upgrade($uni);
my @tests = (
  [undef, "undef"],

t/100_roundtrip.t  view on Meta::CPAN

  [{3 => 'b', sdfghjk => 345}, "hash ref2"],
  [{"fghüjk" => 345}, "non-ascii hash key"],
  do {use utf8; [{"搜索酒店" => "asd"}, "utf8 hash key"] },
  do {use utf8; [{"搜索酒店" => "搜索酒店"}, "utf8 hash all around"] },

  [[[1], [2, [3]]], "nested array ref"],
  [[[1], { foo => [2, [3, {bar => 'baz'}]]}], "nested array and hash refs"],
  [[[1], { foo => [2, [3, {bar => \'baz'}, \[]]]}], "nested array/hash/scalar refs"],

  [[$aryref, $aryref], "repeated substructure"],
  do {my $x = [$aryref, $aryref]; weaken($x->[0]); [$x, "repeated substructure, weaken"] },

  [qr/foo/, "regexp", "this is treated as an object. Not implemented in DDL"],
  [[qr/foo/], "aryref to regexp", "this is treated as an object. Not implemented in DDL"],

  [bless({a => 'b'}, "Foo"), "Simple hash-based object", "Not implemented in Data::Undump", {dump_objects => 1}],
  [[bless({a => bless([1,2,3] => 'fghüjk')}, "Foo")], "Nested objects", "Not implemented in Data::Undump", {dump_objects => 1}],
);

foreach my $test (@tests) {
  does_roundtrip(@$test);



( run in 0.315 second using v1.01-cache-2.11-cpan-65fba6d93b7 )