public
Authored by avatar PotatoGim

[Perl] inverse method flow control with augment()/inner() in Moose/Mouse

augment_innert.pl 614 bytes
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");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment