Rename ext/Data/Dumper to ext/Data-Dumper
[p5sagit/p5-mst-13.2.git] / ext / Data-Dumper / t / overload.t
CommitLineData
823edd99 1#!./perl -w
2
3BEGIN {
fec5e1eb 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 }
be3174d2 13 }
823edd99 14}
15
16use Data::Dumper;
17
18print "1..1\n";
19
20package Foo;
21use overload '""' => 'as_string';
22
23sub new { bless { foo => "bar" }, shift }
24sub as_string { "%%%%" }
25
26package main;
27
28my $f = Foo->new;
29
30print "#\$f=$f\n";
31
32$_ = Dumper($f);
33s/^/#/mg;
34print $_;
35
36print "not " unless /bar/ && /Foo/;
37print "ok 1\n";
38