Is it possible to use MooseX meta attributes with Moops?
Consider this Moose sample code:
use v5.14;
use strict;
use warnings;
package TraitTest;
use Moose;
with 'MooseX::Getopt';
has opt1 => (
traits => ['Getopt'],
is => 'ro',
isa => 'Bool',
cmd_aliases => ['o']
);
1;
package main;
print TraitTest->new_with_options()->opt1 ? "yes\n" : "no\n";
I tried to transform this to Moops like so:
use v5.14;
use strict;
use warnings;
use Moops;
class TraitTest
with MooseX::Getopt
{
has opt1 => (
# metaclass => 'Getopt', # also not working
traits => ['Getopt'],
is => 'ro',
isa => 'Bool',
cmd_aliases => ['o']
);
}
print TraitTest->new_with_options()->opt1 ? "yes\n" : "no\n";
Moops classes are backed by Moo, not Moose by default. Thus MooseX extensions will not usually work.
However, it's possible to use Moose instead of Moo: