MooX::Should - optional type restrictions for Moo attributes
use Moo; use MooX::Should; use Types::Standard -types; has thing => ( is => 'ro', should => Int, );
This module is basically a shortcut for
use Devel::StrictMode; use PerlX::Maybe; has thing => ( is => 'ro', maybe isa => STRICT ? Int : undef, );
It allows you to completely ignore any type restrictions on Moo attributes at runtime, or to selectively enable them.
Note that you can specify a (weaker) type restriction for an attribute:
use Types::Common::Numeric qw/ PositiveInt /; use Types::Standard qw/ Int /; has thing => ( is => 'ro', isa => Int, should => PositiveInt, );
but this is equivalent to
use Devel::StrictMode; has thing => ( is => 'ro', isa => STRICT ? PositiveInt : Int, );
Please report any bugs or feature requests on the bugtracker website https://github.com/robrwo/MooX-Should/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Theo van Hoesel <email@example.com>
Originally written by Robert Rothenberg <firstname.lastname@example.org>.
Mohammad S Anwar <email@example.com>
Robert Rothenberg <firstname.lastname@example.org>
Theo van Hoesel <email@example.com>
Zakariyya Mughal <firstname.lastname@example.org>
This software is Copyright (c) 2018-2021 by Robert Rothenberg.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)