API-MailboxOrg

 view release on metacpan or  search on metacpan

lib/API/MailboxOrg/Types.pm  view on Meta::CPAN

=head1 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'



( run in 0.297 second using v1.01-cache-2.11-cpan-5f2e87ce722 )