6 use Test::More tests => 9;
18 package OverloadingTest;
23 use overload '""' => sub { ref(shift) . " stringified" },
26 sub new { bless {} => shift }
28 package InheritingFromOverloadedTest;
31 use base 'OverloadingTest';
37 q{""} => 'str', ### character
43 package OverloadInheritTwo;
49 Class::C3::initialize();
51 my $x = InheritingFromOverloadedTest->new();
52 isa_ok($x, 'InheritingFromOverloadedTest');
54 my $y = OverloadingTest->new();
55 isa_ok($y, 'OverloadingTest');
57 is("$x", 'InheritingFromOverloadedTest stringified', '... got the right value when stringifing');
58 is("$y", 'OverloadingTest stringified', '... got the right value when stringifing');
60 ok(($y eq 'OverloadingTest stringified'), '... eq was handled correctly');
64 $result = $x eq 'InheritingFromOverloadedTest stringified'
66 ok(!$@, '... this should not throw an exception');
67 ok($result, '... and we should get the true value');
70 my $obj = bless {}, 'OverloadInheritTwo';
72 is($@, '', "Overloading to method name string");
75 #diag Dumper { Class::C3::_dump_MRO_table }