NAME

Types::Set - Set::Equivalence-related type constraints

SYNOPSIS

   package Band {
      use Moose;
      use Types::Standard qw( InstanceOf );
      use Types::Set qw( Set );
      
      has members => (
         is          => 'ro',
         isa         => Set[ InstanceOf['Person'] ],
         coerce      => 1,
         default     => sub { +[] },
         handles     => {
            add_member     => 'insert',
            has_member     => 'contains',
            member_count   => 'size',
         }
      );
   }

DESCRIPTION

Types::Set is a type constraint library built using Type::Tiny; compatible with Moose, Mouse, Moo and more.

Type constraints

AnySet

This type constraint is satisfied by any blessed object that provides insert, delete, members and contains methods.

Set

A blessed Set::Equivalence object.

This may be parameterized with another type constraint; for example, Set[Num] is a set of numbers. In this case, not only must all the set members be numbers, but also the set itself must have a type constraint of Num (or a subtype of Num, such as Int) attached, which will prevent non-numeric values from being inserted into the set later.

This type can coerce from ArrayRef and AnySet.

MutableSet

Like Set, but must be a mutable set. Similar parameterization.

This type can coerce from ImmutableSet, ArrayRef and AnySet.

ImmutableSet

Like Set, but must not be a mutable set. Similar parameterization.

This type can coerce from MutableSet, ArrayRef and AnySet.

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Set-Equivalence.

SEE ALSO

Set::Equivalence.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2013 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.