use
if
$ENV
{AUTHOR_TESTING},
'Test::Warnings'
;
my
@seen
;
sub
new {
bless
{},
shift
}
sub
left {
push
@seen
,
"orig-left"
}
sub
right {
push
@seen
,
"orig-right"
}
our
@ISA
=
'MyParent'
;
before
'left'
,
'right'
=>
sub
{
push
@seen
,
'before'
};
our
@ISA
=
'Child'
;
before
[
'left'
,
'right'
] =>
sub
{
push
@seen
,
'grandbefore'
};
my
$child
= Child->new();
$child
->left;
is_deeply([
splice
@seen
], [
qw/before orig-left/
],
"correct 'left' results"
);
$child
->right;
is_deeply([
splice
@seen
], [
qw/before orig-right/
],
"correct 'right' results"
);
my
$grand
= Grandchild->new();
$grand
->left;
is_deeply([
splice
@seen
], [
qw/grandbefore before orig-left/
],
"correct 'left' results"
);
$grand
->right;
is_deeply([
splice
@seen
], [
qw/grandbefore before orig-right/
],
"correct 'right' results"
);
done_testing;