6 use Test::More tests => 8;
14 package OverloadingTest;
19 use overload '""' => sub { ref(shift) . " stringified" },
22 sub new { bless {} => shift }
24 package InheritingFromOverloadedTest;
27 use base 'OverloadingTest';
33 q{""} => 'str', ### character
39 package OverloadInheritTwo;
45 Class::C3::initialize();
47 my $x = InheritingFromOverloadedTest->new();
48 isa_ok($x, 'InheritingFromOverloadedTest');
50 my $y = OverloadingTest->new();
51 isa_ok($y, 'OverloadingTest');
53 is("$x", 'InheritingFromOverloadedTest stringified', '... got the right value when stringifing');
54 is("$y", 'OverloadingTest stringified', '... got the right value when stringifing');
56 ok(($y eq 'OverloadingTest stringified'), '... eq was handled correctly');
60 $result = $x eq 'InheritingFromOverloadedTest stringified'
62 ok(!$@, '... this should not throw an exception');
63 ok($result, '... and we should get the true value');
66 my $obj = bless {}, 'OverloadInheritTwo';
68 is($@, '', "Overloading to method name string");
71 #diag Dumper { Class::C3::_dump_MRO_table }