| Path-Router documentation | Contained in the Path-Router distribution. |
Path::Router::Types - A set of types that Path::Router uses
use Path::Router::Types;
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.
Stevan Little <stevan.little@iinteractive.com>
Copyright 2008-2011 Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Path-Router documentation | Contained in the Path-Router distribution. |
package Path::Router::Types; use Moose (); use Moose::Util::TypeConstraints; our $VERSION = '0.10'; our $AUTHORITY = 'cpan:STEVAN'; class_type 'Moose::Meta::TypeConstraint'; subtype 'Path::Router::Route::ValidationMap' => as 'HashRef[Moose::Meta::TypeConstraint]'; # NOTE: # canonicalize the route # validators into a simple # set of type constraints # - SL coerce 'Path::Router::Route::ValidationMap' => from 'HashRef[Str | RegexpRef | Moose::Meta::TypeConstraint]' => via { my %orig = %{ +shift }; foreach my $key (keys %orig) { my $val = $orig{$key}; if (ref $val eq 'Regexp') { $orig{$key} = subtype('Str' => where{ /^$val$/ }); } else { $orig{$key} = find_type_constraint($val) || Carp::confess "Could not locate type constraint named $val"; } } return \%orig; }; no Moose; no Moose::Util::TypeConstraints; 1; __END__