6 use Test::More tests => 5;
14 sub foo { 'Foo::foo(' . (inner() || '') . ')' };
15 sub bar { 'Foo::bar(' . (inner() || '') . ')' }
22 augment 'foo' => sub { 'Bar::foo' };
23 override 'bar' => sub { 'Bar::bar -> ' . super() };
30 override 'foo' => sub { 'Baz::foo -> ' . super() };
31 augment 'bar' => sub { 'Baz::bar' };
41 Let em clarify what is happening here. Baz::foo is calling
42 super(), which calls Bar::foo, which is an augmented sub
43 that calls Foo::foo, then calls inner() which actually
44 then calls Bar::foo. Confusing I know,.. but this is
45 *exactly* what is it supposed to do :)
50 'Baz::foo -> Foo::foo(Bar::foo)',
51 '... got the right value from mixed augment/override foo');
55 Allow me to clarify this one now ...
57 Since Baz::bar is an augment routine, it needs to find the
58 correct inner() to be called by. In this case it is Foo::bar.
59 However, Bar::bar is in-between us, so it should actually be
60 called first. Bar::bar is an overriden sub, and calls super()
61 which in turn then calls our Foo::bar, which calls inner(),
64 Confusing I know, but it is correct :)
69 local $TODO = 'mixed augment/override is not supported';
71 'Bar::bar -> Foo::bar(Baz::bar)',
72 '... got the right value from mixed augment/override bar');