12 use Test::More tests => 7;
20 package OverloadingTest;
25 use overload '""' => sub { ref(shift) . " stringified" },
28 sub new { bless {} => shift }
30 package InheritingFromOverloadedTest;
33 use base 'OverloadingTest';
37 my $x = InheritingFromOverloadedTest->new();
38 isa_ok($x, 'InheritingFromOverloadedTest');
40 my $y = OverloadingTest->new();
41 isa_ok($y, 'OverloadingTest');
43 is("$x", 'InheritingFromOverloadedTest stringified', '... got the right value when stringifing');
44 is("$y", 'OverloadingTest stringified', '... got the right value when stringifing');
46 ok(($y eq 'OverloadingTest stringified'), '... eq was handled correctly');
50 $result = $x eq 'InheritingFromOverloadedTest stringified'
52 ok(!$@, '... this should not throw an exception');
53 ok($result, '... and we should get the true value');