Perl and Moose: which Moose-based package should I use as a replacement for MooseX :: Method

To my horror, I noticed that it is MooseX::Methodno longer supported and not recommended.

The package is MooseX-Method-Signaturesadvertised as a replacement, but its documentation says: This is ALPHA SOFTWARE. Use at your own risk. Functions are subject to change.

<whine> What should I do </whine>

+3
source share
1 answer

Use MooseX::Declareinstead:

use MooseX::Declare;

class Foo {
    has foo => (isa => "Str", is => "rw", default => "foo");

    method bar (Str $bar = "bar") {
        print $self->foo, " says $bar\n";
    }
}

Foo->new->bar;
+5
source

Source: https://habr.com/ru/post/1714382/


All Articles