13 use Scalar::Util qw(refaddr);
20 '""' => sub { "foo" },
22 cos => sub { "far side of overload table" },
25 sub new { bless {}, shift };
28 my $x = Stringifies->new;
30 is( "$x", "foo", "stringifies" );
31 is( 0 + $x, 42, "numifies" );
32 is( cos($x), "far side of overload table", "cosinusfies" );
36 is( "$x", overload::StrVal($x), "no stringification" );
37 is( 0 + $x, refaddr($x), "no numification" );
38 is( cos($x), cos(refaddr($x)), "no cosinusfication" );
42 is( "$x", overload::StrVal($x), "no stringification" );
43 is( 0 + $x, refaddr($x), "no numification" );
44 is( cos($x), cos(refaddr($x)), "no cosinusfication" );
51 is( "$x", overload::StrVal($x), "no stringification" );
52 is( 0 + $x, 42, "numifies" );
53 is( cos($x), "far side of overload table", "cosinusfies" );
57 is( "$x", overload::StrVal($x), "no stringification" );
58 is( 0 + $x, refaddr($x), "no numification" );
59 is( cos($x), cos(refaddr($x)), "no cosinusfication" );
64 is( "$x", "foo", "stringifies" );
65 is( 0 + $x, 42, "numifies" );
66 is( cos($x), "far side of overload table", "cosinusfies" );
69 is( "$x", "foo", "stringifies" );
70 is( 0 + $x, refaddr($x), "no numification" );
71 is( cos($x), "far side of overload table", "cosinusfies" );
75 is( "$x", overload::StrVal($x), "no stringification" );
76 is( 0 + $x, refaddr($x), "no numification" );
77 is( cos($x), "far side of overload table", "cosinusfies" );
81 is( "$x", "foo", "stringifies" );
82 is( 0 + $x, 42, "numifies" );
83 is( cos($x), "far side of overload table", "cosinusfies" );
87 is( "$x", "foo", "stringifies" );
88 is( 0 + $x, refaddr($x), "no numification" );
89 is( cos($x), "far side of overload table", "cosinusfies" );
92 is( "$x", "foo", "stringifies" );
93 is( 0 + $x, refaddr($x), "no numification" );
94 is( cos($x), cos(refaddr($x)), "no cosinusfication" );
96 BEGIN { ok(exists($^H{overloading}), "overloading hint present") }
100 BEGIN { ok(!exists($^H{overloading}), "overloading hint removed") }