File Coverage

blib/lib/MooseX/Types/Moose.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 23 23 100.0


line stmt bran cond sub pod time code
1 18     18   1004607 use warnings;
  18         37  
  18         698  
2 18     18   99 use strict;
  18         30  
  18         993  
3             package MooseX::Types::Moose;
4             # ABSTRACT: Type exports that match the types shipped with L<Moose>
5              
6             our $VERSION = '0.50';
7              
8 18     18   5548 use MooseX::Types;
  18         42  
  18         99  
9 18     18   292 use Moose::Util::TypeConstraints ();
  18         30  
  18         453  
10              
11 18     18   92 use namespace::autoclean;
  18         26  
  18         169  
12              
13             #pod =head1 SYNOPSIS
14             #pod
15             #pod package Foo;
16             #pod use Moose;
17             #pod use MooseX::Types::Moose qw( ArrayRef Int Str );
18             #pod use Carp qw( croak );
19             #pod
20             #pod has 'name',
21             #pod is => 'rw',
22             #pod isa => Str;
23             #pod
24             #pod has 'ids',
25             #pod is => 'rw',
26             #pod isa => ArrayRef[Int];
27             #pod
28             #pod sub add {
29             #pod my ($self, $x, $y) = @_;
30             #pod croak 'First arg not an Int' unless is_Int($x);
31             #pod croak 'Second arg not an Int' unless is_Int($y);
32             #pod return $x + $y;
33             #pod }
34             #pod
35             #pod 1;
36             #pod
37             #pod =head1 DESCRIPTION
38             #pod
39             #pod This package contains a virtual library for L<MooseX::Types> that
40             #pod is able to export all types known to L<Moose>. See L<MooseX::Types>
41             #pod for general usage information.
42             #pod
43             #pod =cut
44              
45             # all available builtin types as short and long name
46             my %BuiltIn_Storage
47             = map { ($_) x 2 }
48             Moose::Util::TypeConstraints->list_all_builtin_type_constraints;
49              
50             #pod =head1 METHODS
51             #pod
52             #pod =head2 type_storage
53             #pod
54             #pod Overrides L<MooseX::Types::Base>' C<type_storage> to provide a hash
55             #pod reference containing all built-in L<Moose> types.
56             #pod
57             #pod =cut
58              
59             # use prepopulated builtin hash as type storage
60 1162     1162 1 4045 sub type_storage { \%BuiltIn_Storage }
61              
62             #pod =head1 SEE ALSO
63             #pod
64             #pod L<Moose>,
65             #pod L<Moose::Util::TypeConstraints>
66             #pod
67             #pod =cut
68              
69             1;
70              
71             __END__
72              
73             =pod
74              
75             =encoding UTF-8
76              
77             =head1 NAME
78              
79             MooseX::Types::Moose - Type exports that match the types shipped with L<Moose>
80              
81             =head1 VERSION
82              
83             version 0.50
84              
85             =head1 SYNOPSIS
86              
87             package Foo;
88             use Moose;
89             use MooseX::Types::Moose qw( ArrayRef Int Str );
90             use Carp qw( croak );
91              
92             has 'name',
93             is => 'rw',
94             isa => Str;
95              
96             has 'ids',
97             is => 'rw',
98             isa => ArrayRef[Int];
99              
100             sub add {
101             my ($self, $x, $y) = @_;
102             croak 'First arg not an Int' unless is_Int($x);
103             croak 'Second arg not an Int' unless is_Int($y);
104             return $x + $y;
105             }
106              
107             1;
108              
109             =head1 DESCRIPTION
110              
111             This package contains a virtual library for L<MooseX::Types> that
112             is able to export all types known to L<Moose>. See L<MooseX::Types>
113             for general usage information.
114              
115             =head1 METHODS
116              
117             =head2 type_storage
118              
119             Overrides L<MooseX::Types::Base>' C<type_storage> to provide a hash
120             reference containing all built-in L<Moose> types.
121              
122             =head1 SEE ALSO
123              
124             L<Moose>,
125             L<Moose::Util::TypeConstraints>
126              
127             =head1 SUPPORT
128              
129             Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Types>
130             (or L<bug-MooseX-Types@rt.cpan.org|mailto:bug-MooseX-Types@rt.cpan.org>).
131              
132             There is also a mailing list available for users of this distribution, at
133             L<http://lists.perl.org/list/moose.html>.
134              
135             There is also an irc channel available for users of this distribution, at
136             L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>.
137              
138             =head1 AUTHOR
139              
140             Robert "phaylon" Sedlacek <rs@474.at>
141              
142             =head1 COPYRIGHT AND LICENCE
143              
144             This software is copyright (c) 2007 by Robert "phaylon" Sedlacek.
145              
146             This is free software; you can redistribute it and/or modify it under
147             the same terms as the Perl 5 programming language system itself.
148              
149             =cut