Commit | Line | Data |
---|---|---|
3379cc45 | 1 | package MooseX::Types::Common; |
3ebb788b | 2 | # ABSTRACT: A library of commonly used type constraints |
3379cc45 | 3 | |
4 | use strict; | |
5 | use warnings; | |
acf4d245 | 6 | use Carp qw/cluck/; |
3379cc45 | 7 | |
acf4d245 | 8 | sub import { |
d174f768 | 9 | my $self = shift; |
acf4d245 | 10 | return unless @_; |
11 | cluck("Tried to import the symbols " . join(', ', @_) | |
12 | . " from MooseX::Types::Common.\nDid you mean " | |
13 | . "MooseX::Types::Common::String or MooseX::Type::Common::Numeric?"); | |
14 | } | |
15 | ||
3379cc45 | 16 | 1; |
3ebb788b | 17 | __END__ |
3379cc45 | 18 | |
3ebb788b | 19 | =pod |
3379cc45 | 20 | |
21 | =head1 SYNOPSIS | |
22 | ||
ac73ab52 | 23 | use MooseX::Types::Common::String qw/SimpleStr/; |
3379cc45 | 24 | has short_str => (is => 'rw', isa => SimpleStr); |
25 | ||
26 | ... | |
27 | #this will fail | |
28 | $object->short_str("string\nwith\nbreaks"); | |
29 | ||
3379cc45 | 30 | |
ac73ab52 | 31 | use MooseX::Types::Common::Numeric qw/PositiveInt/; |
32 | has count => (is => 'rw', isa => PositiveInt); | |
3379cc45 | 33 | |
ac73ab52 | 34 | ... |
35 | #this will fail | |
36 | $object->count(-33); | |
3379cc45 | 37 | |
ac73ab52 | 38 | =head1 DESCRIPTION |
3379cc45 | 39 | |
ac73ab52 | 40 | A set of commonly-used type constraints that do not ship with Moose by default. |
3379cc45 | 41 | |
42 | =head1 SEE ALSO | |
43 | ||
44 | =over | |
45 | ||
ac73ab52 | 46 | =item * L<MooseX::Types::Common::String> |
47 | ||
48 | =item * L<MooseX::Types::Common::Numeric> | |
49 | ||
3379cc45 | 50 | =item * L<MooseX::Types> |
51 | ||
52 | =item * L<Moose::Util::TypeConstraints> | |
53 | ||
54 | =back | |
55 | ||
3ebb788b | 56 | =head1 ORIGIN |
3379cc45 | 57 | |
58 | This distribution was extracted from the L<Reaction> code base by Guillermo | |
59 | Roditi (groditi). | |
60 | ||
3379cc45 | 61 | =cut |