Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

perl

moose

To my dismay I noticed that MooseX::Method is no longer maintained and deprecated.

The package MooseX-Method-Signatures is advertized as replacement, but its documentation says: This is ALPHA SOFTWARE. Use at your own risk. Features may change.

<whine>What should I do </whine>

like image 621
lexu Avatar asked Feb 02 '26 13:02

lexu


1 Answers

Use MooseX::Declare instead:

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;
like image 131
Chas. Owens Avatar answered Feb 04 '26 07:02

Chas. Owens



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!