6 use Test::More tests => 8;
18 package OverloadingTest;
23 use overload '""' => sub { ref(shift) . " stringified" },
26 sub new { bless {} => shift }
28 package InheritingFromOverloadedTest;
31 use base 'OverloadingTest';
35 my $x = InheritingFromOverloadedTest->new();
36 isa_ok($x, 'InheritingFromOverloadedTest');
38 my $y = OverloadingTest->new();
39 isa_ok($y, 'OverloadingTest');
41 is("$x", 'InheritingFromOverloadedTest stringified', '... got the right value when stringifing');
42 is("$y", 'OverloadingTest stringified', '... got the right value when stringifing');
44 ok(($y eq 'OverloadingTest stringified'), '... eq was handled correctly');
48 $result = $x eq 'InheritingFromOverloadedTest stringified'
50 ok(!$@, '... this should not throw an exception');
51 ok($result, '... and we should get the true value');
54 #diag Dumper { Class::C3::_dump_MRO_table }