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