1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
use strict;
use warnings;
use Test::More tests => 1;
=pod
rt.cpan.org # 21558
If compile-time code from another module issues a [re]initialize() part-way
through the process of setting up own our modules, that shouldn't prevent
our own initialize() call from working properly.
=cut
{
package TestMRO::A;
use Class::C3;
sub testmethod { 42 }
package TestMRO::B;
BEGIN { our @ISA = ('TestMRO::A'); }
use Class::C3;
package TestMRO::C;
BEGIN { our @ISA = ('TestMRO::A'); }
use Class::C3;
sub testmethod { shift->next::method + 1 }
package TestMRO::D;
BEGIN { Class::C3::initialize }
BEGIN { our @ISA = ('TestMRO::B'); }
BEGIN { our @ISA = ('TestMRO::C'); }
use Class::C3;
sub new {
my $class = shift;
my $self = {};
bless $self => $class;
}
}
Class::C3::initialize;
is(TestMRO::D->new->testmethod, 43, 'double-initialize works ok');
|