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 16     16   1592217 use warnings;
  16         43  
  16         507  
2 16     16   93 use strict;
  16         33  
  16         1057  
3             package MooseX::Types::Moose;
4             # ABSTRACT: Type exports that match the types shipped with L<Moose>
5             $MooseX::Types::Moose::VERSION = '0.45';
6 16     16   13313 use MooseX::Types;
  16         44  
  16         108  
7 16     16   217 use Moose::Util::TypeConstraints ();
  16         37  
  16         332  
8              
9 16     16   141 use namespace::autoclean;
  16         41  
  16         130  
10              
11             #pod =head1 SYNOPSIS
12             #pod
13             #pod package Foo;
14             #pod use Moose;
15             #pod use MooseX::Types::Moose qw( ArrayRef Int Str );
16             #pod use Carp qw( croak );
17             #pod
18             #pod has 'name',
19             #pod is => 'rw',
20             #pod isa => Str;
21             #pod
22             #pod has 'ids',
23             #pod is => 'rw',
24             #pod isa => ArrayRef[Int];
25             #pod
26             #pod sub add {
27             #pod my ($self, $x, $y) = @_;
28             #pod croak 'First arg not an Int' unless is_Int($x);
29             #pod croak 'Second arg not an Int' unless is_Int($y);
30             #pod return $x + $y;
31             #pod }
32             #pod
33             #pod 1;
34             #pod
35             #pod =head1 DESCRIPTION
36             #pod
37             #pod This package contains a virtual library for L<MooseX::Types> that
38             #pod is able to export all types known to L<Moose>. See L<MooseX::Types>
39             #pod for general usage information.
40             #pod
41             #pod =cut
42              
43             # all available builtin types as short and long name
44             my %BuiltIn_Storage
45             = map { ($_) x 2 }
46             Moose::Util::TypeConstraints->list_all_builtin_type_constraints;
47              
48             #pod =head1 METHODS
49             #pod
50             #pod =head2 type_storage
51             #pod
52             #pod Overrides L<MooseX::Types::Base>' C<type_storage> to provide a hash
53             #pod reference containing all built-in L<Moose> types.
54             #pod
55             #pod =cut
56              
57             # use prepopulated builtin hash as type storage
58 1033     1033 1 4584 sub type_storage { \%BuiltIn_Storage }
59              
60             #pod =head1 SEE ALSO
61             #pod
62             #pod L<MooseX::Types::Moose>,
63             #pod L<Moose>,
64             #pod L<Moose::Util::TypeConstraints>
65             #pod
66             #pod =cut
67              
68             1;
69              
70             __END__
71              
72             =pod
73              
74             =encoding UTF-8
75              
76             =head1 NAME
77              
78             MooseX::Types::Moose - Type exports that match the types shipped with L<Moose>
79              
80             =head1 VERSION
81              
82             version 0.45
83              
84             =head1 SYNOPSIS
85              
86             package Foo;
87             use Moose;
88             use MooseX::Types::Moose qw( ArrayRef Int Str );
89             use Carp qw( croak );
90              
91             has 'name',
92             is => 'rw',
93             isa => Str;
94              
95             has 'ids',
96             is => 'rw',
97             isa => ArrayRef[Int];
98              
99             sub add {
100             my ($self, $x, $y) = @_;
101             croak 'First arg not an Int' unless is_Int($x);
102             croak 'Second arg not an Int' unless is_Int($y);
103             return $x + $y;
104             }
105              
106             1;
107              
108             =head1 DESCRIPTION
109              
110             This package contains a virtual library for L<MooseX::Types> that
111             is able to export all types known to L<Moose>. See L<MooseX::Types>
112             for general usage information.
113              
114             =head1 METHODS
115              
116             =head2 type_storage
117              
118             Overrides L<MooseX::Types::Base>' C<type_storage> to provide a hash
119             reference containing all built-in L<Moose> types.
120              
121             =head1 SEE ALSO
122              
123             L<MooseX::Types::Moose>,
124             L<Moose>,
125             L<Moose::Util::TypeConstraints>
126              
127             =head1 AUTHOR
128              
129             Robert "phaylon" Sedlacek <rs@474.at>
130              
131             =head1 COPYRIGHT AND LICENSE
132              
133             This software is copyright (c) 2007 by Robert "phaylon" Sedlacek.
134              
135             This is free software; you can redistribute it and/or modify it under
136             the same terms as the Perl 5 programming language system itself.
137              
138             =cut