diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-03-13 23:10:38 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-03-13 23:10:38 +0000 |
commit | fb32a4e06a459a4204ef7d9ac6619ff48b88166a (patch) | |
tree | 3d96f532fd6826d01177eed062104e4cb3e72b96 /lib/Reaction/Types | |
parent | b9c9838d0760a51643e87b995a3db65dd8cb94a3 (diff) | |
download | reaction-fb32a4e06a459a4204ef7d9ac6619ff48b88166a.tar.gz reaction-fb32a4e06a459a4204ef7d9ac6619ff48b88166a.zip |
new URI type
Diffstat (limited to 'lib/Reaction/Types')
-rw-r--r-- | lib/Reaction/Types/Core.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Reaction/Types/Core.pm b/lib/Reaction/Types/Core.pm index afd7454..42c6ca3 100644 --- a/lib/Reaction/Types/Core.pm +++ b/lib/Reaction/Types/Core.pm @@ -2,9 +2,9 @@ package Reaction::Types::Core; use MooseX::Types -declare => [qw/SimpleStr NonEmptySimpleStr Password StrongPassword - NonEmptyStr PositiveNum PositiveInt SingleDigit/]; + NonEmptyStr PositiveNum PositiveInt SingleDigit URI/]; -use MooseX::Types::Moose qw/Str Num Int/; +use MooseX::Types::Moose qw/Str Num Int Object/; subtype SimpleStr, as Str, @@ -49,6 +49,10 @@ subtype SingleDigit, where { $_ <= 9 }, message { "Must be a single digit" }; + +class_type 'URI', message { 'Must be an URI object'}; +coerce 'URI', from 'Str', via { URI->new($_) }; + 1; =head1 NAME @@ -61,7 +65,7 @@ Reaction::Types::Core Reaction uses the L<Moose> attributes as a base and adds a few of it's own. -=over +=over =item * SimpleStr @@ -87,7 +91,7 @@ Does what it says on the tin. =head1 SEE ALSO -=over +=over =item * L<Moose::Util::TypeConstraints> |