6 use Test::More tests => 6;
16 sub foo { 'Foo::foo(' . (inner() || '') . ')' };
17 sub bar { 'Foo::bar(' . (inner() || '') . ')' }
24 augment 'foo' => sub { 'Bar::foo' };
25 override 'bar' => sub { 'Bar::bar -> ' . super() };
32 override 'foo' => sub { 'Baz::foo -> ' . super() };
33 augment 'bar' => sub { 'Baz::bar' };
43 Let em clarify what is happening here. Baz::foo is calling
44 super(), which calls Bar::foo, which is an augmented sub
45 that calls Foo::foo, then calls inner() which actually
46 then calls Bar::foo. Confusing I know,.. but this is
47 *exactly* what is it supposed to do :)
52 'Baz::foo -> Foo::foo(Bar::foo)',
53 '... got the right value from mixed augment/override foo');
57 Allow me to clarify this one now ...
59 Since Baz::bar is an augment routine, it needs to find the
60 correct inner() to be called by. In this case it is Foo::bar.
61 However, Bar::bar is inbetween us, so it should actually be
62 called first. Bar::bar is an overriden sub, and calls super()
63 which in turn then calls our Foo::bar, which calls inner(),
66 Confusing I know, but it is correct :)
71 'Bar::bar -> Foo::bar(Baz::bar)',
72 '... got the right value from mixed augment/override bar');