6 use Test::More tests => 17;
19 sub foo { 'Foo::foo(' . (inner() || '') . ')' }
20 sub bar { 'Foo::bar(' . (inner() || '') . ')' }
21 sub baz { 'Foo::baz(' . (inner() || '') . ')' }
30 augment foo => sub { 'Bar::foo(' . (inner() || '') . ')' };
31 augment bar => sub { 'Bar::bar' };
40 augment foo => sub { 'Baz::foo' };
41 augment baz => sub { 'Baz::baz' };
43 # this will actually never run,
44 # because Bar::bar does not call inner()
45 augment bar => sub { 'Baz::bar' };
53 is($baz->foo(), 'Foo::foo(Bar::foo(Baz::foo))', '... got the right value from &foo');
54 is($baz->bar(), 'Foo::bar(Bar::bar)', '... got the right value from &bar');
55 is($baz->baz(), 'Foo::baz(Baz::baz)', '... got the right value from &baz');
61 is($bar->foo(), 'Foo::foo(Bar::foo())', '... got the right value from &foo');
62 is($bar->bar(), 'Foo::bar(Bar::bar)', '... got the right value from &bar');
63 is($bar->baz(), 'Foo::baz()', '... got the right value from &baz');
68 is($foo->foo(), 'Foo::foo()', '... got the right value from &foo');
69 is($foo->bar(), 'Foo::bar()', '... got the right value from &bar');
70 is($foo->baz(), 'Foo::baz()', '... got the right value from &baz');
80 sub bling { 'Bling::bling' }
89 sub bling { 'Bling::bling' }
92 augment 'bling' => sub {};
93 } '... cannot augment a method which has a local equivalent';