Data::Dumper hash iterator needs to be reset on all hashrefs (fixes #64744)
[p5sagit/p5-mst-13.2.git] / ext / Data-Dumper / t / overload.t
1 #!./perl -w
2
3 BEGIN {
4     if ($ENV{PERL_CORE}){
5         chdir 't' if -d 't';
6         @INC = '../lib';
7         require Config; import Config;
8         no warnings 'once';
9         if ($Config{'extensions'} !~ /\bData\/Dumper\b/) {
10             print "1..0 # Skip: Data::Dumper was not built\n";
11             exit 0;
12         }
13     }
14 }
15
16 use Data::Dumper;
17
18 print "1..1\n";
19
20 package Foo;
21 use overload '""' => 'as_string';
22
23 sub new { bless { foo => "bar" }, shift }
24 sub as_string { "%%%%" }
25
26 package main;
27
28 my $f = Foo->new;
29
30 print "#\$f=$f\n";
31
32 $_ = Dumper($f);
33 s/^/#/mg;
34 print $_;
35
36 print "not " unless /bar/ && /Foo/;
37 print "ok 1\n";
38