Begin adding Mouse::TypeRegistry. All that's there for now is Bool
[gitmo/Mouse.git] / lib / Mouse / TypeRegistry.pm
1 #!/usr/bin/env perl
2 package Mouse::TypeRegistry;
3 use strict;
4 use warnings;
5
6 sub optimized_constraints {
7     return {
8         Any        => sub { 1 },
9         Item       => sub { 1 },
10         Bool       => sub {
11             !defined($_) || $_ eq "" || "$_" eq '1' || "$_" eq '0'
12         },
13         Undef      => sub { 1 },
14         Defined    => sub { 1 },
15         Value      => sub { 1 },
16         Num        => sub { 1 },
17         Int        => sub { 1 },
18         Str        => sub { 1 },
19         ClassName  => sub { 1 },
20         Ref        => sub { 1 },
21         ScalarRef  => sub { 1 },
22         ArrayRef   => sub { 1 },
23         HashRef    => sub { 1 },
24         CodeRef    => sub { 1 },
25         RegexpRef  => sub { 1 },
26         GlobRef    => sub { 1 },
27         FileHandle => sub { 1 },
28         Object     => sub { 1 },
29     };
30 }
31
32 1;
33