NAME
API::MailboxOrg::Types - Types related to Mailbox.org API
VERSION
version 1.0.2
SYNOPSIS
{
package # private package - do not index
TestClass;
use Moo;
use API::MailboxOrg::Types qw(Boolean HashRefRestricted);
has true_or_false => ( is => 'ro', isa => Boolean, coerce => 1 );
has map => ( is => 'ro', isa => HashRefRestricted[qw(a b)] ); # allow only keys a and b
1;
}
my $obj = TestClass->new(
true_or_false => 1, # 0|1|""|undef|JSON::PP::Boolean object
map => {
a => 1,
b => 1,
# a key 'c' would cause a 'die'
},
);
TYPES
HashRefRestricted[`a]
This expects a hash reference. You can restrict the allowed keys
Boolean
A JSON::PP::Boolean object.
COERCIONS
These coercions are defined.
To Boolean
String/Integer to boolean
The values "" (empty string), undef, 0, and 1 are coerced to
JSON::PP::Boolean
objects.
AUTHOR
Renee Baecker <reneeb@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2022 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)