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   1051486 use warnings;
  16         39  
  16         455  
2 16     16   83 use strict;
  16         30  
  16         813  
3             package MooseX::Types::Moose;
4             # ABSTRACT: Type exports that match the types shipped with L<Moose>
5              
6             our $VERSION = '0.46';
7              
8 16     16   5432 use MooseX::Types;
  16         41  
  16         88  
9 16     16   159 use Moose::Util::TypeConstraints ();
  16         30  
  16         288  
10              
11 16     16   79 use namespace::autoclean;
  16         24  
  16         90  
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 1033     1033 1 4015 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.46
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 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