Commit | Line | Data |
3379cc45 |
1 | package MooseX::Types::Common; |
2 | |
3 | use strict; |
4 | use warnings; |
acf4d245 |
5 | use Carp qw/cluck/; |
3379cc45 |
6 | |
31633b26 |
7 | our $VERSION = '0.001005'; |
3379cc45 |
8 | |
acf4d245 |
9 | sub import { |
10 | my $package = shift; |
11 | return unless @_; |
12 | cluck("Tried to import the symbols " . join(', ', @_) |
13 | . " from MooseX::Types::Common.\nDid you mean " |
14 | . "MooseX::Types::Common::String or MooseX::Type::Common::Numeric?"); |
15 | } |
16 | |
3379cc45 |
17 | 1; |
18 | |
19 | =head1 NAME |
20 | |
6820e939 |
21 | MooseX::Types::Common - A library of commonly used type constraints |
3379cc45 |
22 | |
23 | =head1 SYNOPSIS |
24 | |
ac73ab52 |
25 | use MooseX::Types::Common::String qw/SimpleStr/; |
3379cc45 |
26 | has short_str => (is => 'rw', isa => SimpleStr); |
27 | |
28 | ... |
29 | #this will fail |
30 | $object->short_str("string\nwith\nbreaks"); |
31 | |
3379cc45 |
32 | |
3379cc45 |
33 | |
ac73ab52 |
34 | use MooseX::Types::Common::Numeric qw/PositiveInt/; |
35 | has count => (is => 'rw', isa => PositiveInt); |
3379cc45 |
36 | |
ac73ab52 |
37 | ... |
38 | #this will fail |
39 | $object->count(-33); |
3379cc45 |
40 | |
ac73ab52 |
41 | =head1 DESCRIPTION |
3379cc45 |
42 | |
ac73ab52 |
43 | A set of commonly-used type constraints that do not ship with Moose by default. |
3379cc45 |
44 | |
45 | =head1 SEE ALSO |
46 | |
47 | =over |
48 | |
ac73ab52 |
49 | =item * L<MooseX::Types::Common::String> |
50 | |
51 | =item * L<MooseX::Types::Common::Numeric> |
52 | |
3379cc45 |
53 | =item * L<MooseX::Types> |
54 | |
55 | =item * L<Moose::Util::TypeConstraints> |
56 | |
57 | =back |
58 | |
59 | =head1 AUTHORS |
60 | |
61 | This distribution was extracted from the L<Reaction> code base by Guillermo |
62 | Roditi (groditi). |
63 | |
64 | The original authors of this library are: |
65 | |
66 | =over 4 |
67 | |
68 | =item * Matt S. Trout |
69 | |
70 | =item * K. J. Cheetham |
71 | |
72 | =item * Guillermo Roditi |
73 | |
74 | =back |
75 | |
76 | =head1 LICENSE |
77 | |
78 | This library is free software, you can redistribute it and/or modify |
79 | it under the same terms as Perl itself. |
80 | |
81 | =cut |