release 0.42
[Data-Peek.git] / sandbox / genout.pl
bloba1ceef86729c7806b32f431beb938aa0835b266d
1 #!/pro/bin/perl
3 use strict;
4 use warnings;
6 BEGIN { unshift @INC, qw( blib/lib blib/arch ) }
8 use Data::Peek;
9 use Data::Dumper;
10 $Data::Dumper::Sortkeys = 1;
11 $Data::Dumper::Indent = 1;
13 my ($use_perlio, $dump_hash) = (@ARGV, 0, 0);
14 $dump_hash or $Data::Peek::has_perlio = $Data::Peek::has_perlio = $use_perlio;
16 my $var = "";
17 foreach my $ref ("", "\\") {
18 foreach my $in (
19 'undef', 0, 1,
20 '""', '"\xa8"', '"ab\x0a\x{20ac}"',
21 ) {
22 eval "\$var = $ref$in;";
23 my $dump;
24 if ($dump_hash) {
25 my %hash = DDump ($var);
26 $dump = Dumper (\%hash);
28 else {
29 $dump = DDump ($var);
31 $dump =~ s/\b0x[0-9a-f]+\b/0x****/g;
32 $dump =~ s/\bab(\\n|\\12|n)/ab\\n/g;
33 $dump =~ s/\b(REFCNT'?\s+=>?\s*) ('?)[0-9]{4,}\2/$1 $2-1$2/g;
34 print "$ref$in\n--\n$dump==\n";