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