1#!./perl -w 2 3BEGIN { 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 14use strict; 15use Data::Dumper; 16 17use Test::More tests => 4; 18 19package Foo; 20use overload '""' => 'as_string'; 21 22sub new { bless { foo => "bar" }, shift } 23sub as_string { "%%%%" } 24 25package main; 26 27my $f = Foo->new; 28 29isa_ok($f, 'Foo'); 30is("$f", '%%%%', 'String overloading works'); 31 32my $d = Dumper($f); 33 34like($d, qr/bar/); 35like($d, qr/Foo/); 36 37