bump version to 0.26
[gitmo/MooseX-Types.git] / lib / MooseX / Types / Moose.pm
1 package MooseX::Types::Moose;
2 our $VERSION = "0.26";
3
4 =head1 NAME
5
6 MooseX::Types::Moose - Types shipped with L<Moose>
7
8 =cut
9
10 use warnings;
11 use strict;
12
13 use MooseX::Types;
14 use Moose::Util::TypeConstraints ();
15
16 use namespace::clean -except => [qw( meta )];
17
18 =head1 SYNOPSIS
19
20   package Foo;
21   use Moose;
22   use MooseX::Types::Moose qw( Int Str );
23   use Carp qw( croak );
24
25   has 'name',
26     is  => 'rw',
27     isa => Str;
28
29   has 'id',
30     is  => 'rw',
31     isa => Int;
32
33   sub add {
34       my ($self, $x, $y) = @_;
35       croak 'First arg not an Int'  unless is_Int($x);
36       croak 'Second arg not an Int' unless is_Int($y);
37       return $x + $y;
38   }
39
40   1;
41
42 =head1 DESCRIPTION
43
44 This package contains a virtual library for L<MooseX::Types> that
45 is able to export all types known to L<Moose>. See L<MooseX::Types>
46 for general usage information.
47
48 =cut
49
50 # all available builtin types as short and long name
51 my %BuiltIn_Storage 
52   = map { ($_) x 2 } 
53     Moose::Util::TypeConstraints->list_all_builtin_type_constraints;
54
55 =head1 METHODS
56
57 =head2 type_storage
58
59 Overrides L<MooseX::Types::Base>' C<type_storage> to provide a hash
60 reference containing all built-in L<Moose> types.
61
62 =cut
63
64 # use prepopulated builtin hash as type storage
65 sub type_storage { \%BuiltIn_Storage }
66
67 =head1 SEE ALSO
68
69 L<MooseX::Types::Moose>,
70 L<Moose>, 
71 L<Moose::Util::TypeConstraints>
72
73 =head1 AUTHOR
74
75 See L<MooseX::Types/AUTHOR>.
76
77 =head1 LICENSE
78
79 This program is free software; you can redistribute it and/or modify
80 it under the same terms as perl itself.
81
82 =cut
83
84 1;