Subject: | [Need workaround] Calling overload::Overloaded() can corrupt fallback on 5.8.x instanceless classes |
See below reproducible (albeit convoluted) case. This is the root cause of Moose starting to crap itself on 5.8.x when ::WithOverloading got cored.
---
~$ perl -e '
use strict;
use warnings;
{
package Foo;
# *MUST* be a deref overload standalone, any additional will not do
use overload "%{}" => sub { sub {} }, fallback => 1;
}
{
package SubFoo0;
use base "Foo";
}
{
package SubFoo1;
use base "Foo";
}
for my $peek_overload (0, 1) {
my $class = "SubFoo$peek_overload";
if( $peek_overload ) {
# if we make an object before calling overload::Overloaded - we are golden
# it iss likely some sort of workaround lies this way
#bless {}, $class;
require Devel::OverloadInfo;
Devel::OverloadInfo::overload_info($class);
# same effect as above, D::OI is not really needed
# overload::Overloaded($class)
}
my $x = bless {}, $class;
warn "Foo!\n" if $x;
}
'