summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/t/lib/dumper-ovl.t
blob: d4b3a924ae43b61124ea4ab9917f5874077412a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!./perl -w

BEGIN {
    chdir 't' if -d 't';
    @INC = '../lib';
    require Config; import Config;
    if ($Config{'extensions'} !~ /\bData\/Dumper\b/) {
      print "1..0 # Skip: Data::Dumper was not built\n";
      exit 0;
    }
}

use Data::Dumper;

print "1..1\n";

package Foo;
use overload '""' => 'as_string';

sub new { bless { foo => "bar" }, shift }
sub as_string { "%%%%" }

package main;

my $f = Foo->new;

print "#\$f=$f\n";

$_ = Dumper($f);
s/^/#/mg;
print $_;

print "not " unless /bar/ && /Foo/;
print "ok 1\n";

OpenPOWER on IntegriCloud