line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Path::Router::Types; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:STEVAN'; |
3
|
|
|
|
|
|
|
# ABSTRACT: A set of types that Path::Router uses |
4
|
|
|
|
|
|
|
$Path::Router::Types::VERSION = '0.15'; |
5
|
15
|
|
|
15
|
|
58
|
use strict; |
|
15
|
|
|
|
|
18
|
|
|
15
|
|
|
|
|
353
|
|
6
|
15
|
|
|
15
|
|
50
|
use warnings; |
|
15
|
|
|
|
|
21
|
|
|
15
|
|
|
|
|
374
|
|
7
|
|
|
|
|
|
|
|
8
|
15
|
|
|
15
|
|
54
|
use Carp 1.32 (); |
|
15
|
|
|
|
|
217
|
|
|
15
|
|
|
|
|
483
|
|
9
|
|
|
|
|
|
|
|
10
|
15
|
|
|
|
|
76
|
use Type::Library 1.000005 -base, |
11
|
15
|
|
|
15
|
|
57
|
-declare => qw(PathRouterRouteValidationMap); |
|
15
|
|
|
|
|
206
|
|
12
|
15
|
|
|
15
|
|
10023
|
use Type::Utils 1.000005 -all; |
|
15
|
|
|
|
|
45796
|
|
|
15
|
|
|
|
|
102
|
|
13
|
15
|
|
|
15
|
|
28222
|
use Types::Standard 1.000005 -types; |
|
15
|
|
|
|
|
186
|
|
|
15
|
|
|
|
|
73
|
|
14
|
15
|
|
|
15
|
|
38007
|
use Types::TypeTiny 1.000005 qw(TypeTiny); |
|
15
|
|
|
|
|
216
|
|
|
15
|
|
|
|
|
68
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
declare PathRouterRouteValidationMap, |
17
|
|
|
|
|
|
|
as HashRef[TypeTiny]; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# NOTE: |
20
|
|
|
|
|
|
|
# canonicalize the route |
21
|
|
|
|
|
|
|
# validators into a simple |
22
|
|
|
|
|
|
|
# set of type constraints |
23
|
|
|
|
|
|
|
# - SL |
24
|
|
|
|
|
|
|
coerce PathRouterRouteValidationMap, |
25
|
|
|
|
|
|
|
from HashRef[Str | RegexpRef | TypeTiny], |
26
|
|
|
|
|
|
|
via { |
27
|
|
|
|
|
|
|
my %orig = %{ +shift }; |
28
|
|
|
|
|
|
|
foreach my $key (keys %orig) { |
29
|
|
|
|
|
|
|
my $val = $orig{$key}; |
30
|
|
|
|
|
|
|
if (ref $val eq 'Regexp') { |
31
|
|
|
|
|
|
|
$orig{$key} = declare(as Str, where{ /^$val$/ }); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
elsif (TypeTiny->check($val)) { |
34
|
|
|
|
|
|
|
$orig{$key} = $val; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else { |
37
|
|
|
|
|
|
|
$orig{$key} = dwim_type($val) |
38
|
|
|
|
|
|
|
|| Carp::confess "Could not locate type constraint named $val"; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
return \%orig; |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=pod |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=encoding UTF-8 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 NAME |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Path::Router::Types - A set of types that Path::Router uses |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 VERSION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
version 0.15 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SYNOPSIS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
use Path::Router::Types; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 BUGS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
All complex software has bugs lurking in it, and this module is no |
69
|
|
|
|
|
|
|
exception. If you find a bug please either email me, or add the bug |
70
|
|
|
|
|
|
|
to cpan-RT. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Stevan Little E<lt>stevan@cpan.orgE<gt> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Copyright 2008-2011 Infinity Interactive, Inc. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
L<http://www.iinteractive.com> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
83
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Stevan Little <stevan@cpan.org> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Infinity Interactive. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
94
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |