6 use Test::More tests => 6;
18 sub foo { 'Foo::foo(' . (inner() || '') . ')' };
19 sub bar { 'Foo::bar(' . (inner() || '') . ')' }
28 augment 'foo' => sub { 'Bar::foo' };
29 override 'bar' => sub { 'Bar::bar -> ' . super() };
38 override 'foo' => sub { 'Baz::foo -> ' . super() };
39 augment 'bar' => sub { 'Baz::bar' };
49 Let em clarify what is happening here. Baz::foo is calling
50 super(), which calls Bar::foo, which is an augmented sub
51 that calls Foo::foo, then calls inner() which actually
52 then calls Bar::foo. Confusing I know,.. but this is
53 *exactly* what is it supposed to do :)
58 'Baz::foo -> Foo::foo(Bar::foo)',
59 '... got the right value from mixed augment/override foo');
63 Allow me to clarify this one now ...
65 Since Baz::bar is an augment routine, it needs to find the
66 correct inner() to be called by. In this case it is Foo::bar.
67 However, Bar::bar is inbetween us, so it should actually be
68 called first. Bar::bar is an overriden sub, and calls super()
69 which in turn then calls our Foo::bar, which calls inner(),
72 Confusing I know, but it is correct :)
77 'Bar::bar -> Foo::bar(Baz::bar)',
78 '... got the right value from mixed augment/override bar');