public
Authored by
PotatoGim

[Perl] inverse method flow control with augment()/inner() in Moose/Mouse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package My::Test;
use Mouse;
sub test
{
my $self = shift;
my $args = shift;
return "My::Test\n" . inner($args);
}
package My::Test::Child;
use Mouse;
extends 'My::Test';
augment 'test' => sub
{
my $self = shift;
my $args = shift;
return "My::Test::Child: $args\n" . inner($args);
};
package My::Test::Child::Child;
use Mouse;
extends 'My::Test::Child';
augment 'test' => sub
{
my $self = shift;
my $args = shift;
return "My::Test::Child::Child: $args\n";
};
package main;
print My::Test::Child::Child->new->test("ARGS1");
Please register or sign in to comment