Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robrwo/moox-should
optional type restrictions for Moo attributes
https://github.com/robrwo/moox-should
Last synced: 11 days ago
JSON representation
optional type restrictions for Moo attributes
- Host: GitHub
- URL: https://github.com/robrwo/moox-should
- Owner: robrwo
- Created: 2018-08-21T07:40:25.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-22T13:09:25.000Z (over 3 years ago)
- Last Synced: 2024-10-11T21:56:26.750Z (about 1 month ago)
- Language: Perl
- Size: 26.4 KB
- Stars: 0
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
Awesome Lists containing this project
README
# NAME
MooX::Should - optional type restrictions for Moo attributes
# VERSION
version v0.1.4
# SYNOPSIS
```perl
use Moo;use MooX::Should;
use Types::Standard -types;has thing => (
is => 'ro',
should => Int,
);
```# DESCRIPTION
This module is basically a shortcut for
```perl
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](https://metacpan.org/pod/Moo)
attributes at runtime, or to selectively enable them.Note that you can specify a (weaker) type restriction for an attribute:
```perl
use Types::Common::Numeric qw/ PositiveInt /;
use Types::Standard qw/ Int /;has thing => (
is => 'ro',
isa => Int,
should => PositiveInt,
);
```but this is equivalent to
```perl
use Devel::StrictMode;has thing => (
is => 'ro',
isa => STRICT ? PositiveInt : Int,
);
```# SEE ALSO
- [Devel::StrictMode](https://metacpan.org/pod/Devel%3A%3AStrictMode)
- [PerlX::Maybe](https://metacpan.org/pod/PerlX%3A%3AMaybe)# SOURCE
The development version is on github at [https://github.com/robrwo/MooX-Should](https://github.com/robrwo/MooX-Should)
and may be cloned from [git://github.com/robrwo/MooX-Should.git](git://github.com/robrwo/MooX-Should.git)# BUGS
Please report any bugs or feature requests on the bugtracker website
[https://github.com/robrwo/MooX-Should/issues](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.# AUTHOR
Theo van Hoesel
Originally written by Robert Rothenberg .
# CONTRIBUTORS
- Mohammad S Anwar
- Robert Rothenberg
- Theo van Hoesel
- Zakariyya Mughal# COPYRIGHT AND LICENSE
This software is Copyright (c) 2018-2021 by Robert Rothenberg.
This is free software, licensed under:
```
The Artistic License 2.0 (GPL Compatible)
```