Contents

MX::AttributeShortcuts -- now with Moo-style type constraints

Contents

I just released MooseX::AttributeShortcuts 0.028; it incorporates Moo-style type constraints.

…largely because I needed to relax, and wrote MooseX::Meta::TypeConstraint::Mooish :)

That means you can now pass a coderef to has() in isa that, like with Moo, dies on validation failure and lives on validation success:

1
2
3
4
5
6
7
8
# easiest is via AttributeShortcuts
use MooseX::AttributeShortcuts 0.028;

has foo => (
  is => 'rw',
  # $_[0] == the value to be validated
  isa => sub { die unless $_[0] == 5 },
);