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