source: trunk/essentials/dev-lang/perl/ext/Data/Dumper/t/overload.t

Last change on this file was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 626 bytes
Line 
1#!./perl -w
2
3BEGIN {
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
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
Note: See TracBrowser for help on using the repository browser.