line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Path::Dispatcher::Rule::Regex; |
2
|
32
|
|
|
32
|
|
127
|
use Any::Moose; |
|
32
|
|
|
|
|
47
|
|
|
32
|
|
|
|
|
148
|
|
3
|
|
|
|
|
|
|
extends 'Path::Dispatcher::Rule'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
has regex => ( |
6
|
|
|
|
|
|
|
is => 'ro', |
7
|
|
|
|
|
|
|
isa => 'RegexpRef', |
8
|
|
|
|
|
|
|
required => 1, |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
|
11
|
32
|
|
|
32
|
|
16128
|
my $named_captures = $] > 5.010 ? eval 'sub { %+ }' : sub { }; |
|
32
|
|
|
|
|
14028
|
|
|
32
|
|
|
|
|
685
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _match { |
14
|
58
|
|
|
58
|
|
70
|
my $self = shift; |
15
|
58
|
|
|
|
|
65
|
my $path = shift; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# davem++ http://www.nntp.perl.org/group/perl.perl5.porters/2013/03/msg200156.html |
18
|
58
|
100
|
|
|
|
163
|
if ($self->prefix) { |
19
|
5
|
|
|
|
|
286
|
eval q{$'}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
58
|
100
|
|
|
|
563
|
return unless my @positional = $path->path =~ $self->regex; |
23
|
|
|
|
|
|
|
|
24
|
48
|
|
|
|
|
1400
|
my %named = $named_captures->(); |
25
|
|
|
|
|
|
|
|
26
|
48
|
|
|
|
|
82
|
my %extra; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# only provide leftover if we need it. $' is slow, and it may be undef |
29
|
48
|
100
|
|
|
|
175
|
if ($self->prefix) { |
30
|
4
|
|
|
|
|
145
|
$extra{leftover} = eval q{$'}; |
31
|
4
|
50
|
|
|
|
15
|
delete $extra{leftover} if !defined($extra{leftover}); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return { |
35
|
48
|
|
|
|
|
239
|
positional_captures => \@positional, |
36
|
|
|
|
|
|
|
named_captures => \%named, |
37
|
|
|
|
|
|
|
%extra, |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
42
|
32
|
|
|
32
|
|
17033
|
no Any::Moose; |
|
32
|
|
|
|
|
57
|
|
|
32
|
|
|
|
|
127
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |