13 use Scalar::Util qw(refaddr);
20 '""' => sub { "foo" },
24 sub new { bless {}, shift };
27 my $x = Stringifies->new;
29 is( "$x", "foo", "stringifies" );
30 is( 0 + $x, 42, "numifies" );
34 is( "$x", overload::StrVal($x), "no stringification" );
35 is( 0 + $x, refaddr($x), "no numification" );
39 is( "$x", overload::StrVal($x), "no stringification" );
40 is( 0 + $x, refaddr($x), "no numification" );
47 is( "$x", overload::StrVal($x), "no stringification" );
48 is( 0 + $x, 42, "numifies" );
52 is( "$x", overload::StrVal($x), "no stringification" );
53 is( 0 + $x, refaddr($x), "no numification" );
58 is( "$x", "foo", "stringifies" );
59 is( 0 + $x, 42, "numifies" );
62 is( "$x", "foo", "stringifies" );
63 is( 0 + $x, refaddr($x), "no numification" );
67 is( "$x", overload::StrVal($x), "no stringification" );
68 is( 0 + $x, refaddr($x), "no numification" );
72 is( "$x", "foo", "stringifies" );
73 is( 0 + $x, 42, "numifies" );
77 is( "$x", "foo", "stringifies" );
78 is( 0 + $x, refaddr($x), "no numification" );
81 BEGIN { ok(exists($^H{overloading}), "overloading hint present") }
85 BEGIN { ok(!exists($^H{overloading}), "overloading hint removed") }