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