line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Web::Dispatch::Node; |
2
|
|
|
|
|
|
|
|
3
|
13
|
|
|
13
|
|
83
|
use Moo; |
|
13
|
|
|
|
|
25
|
|
|
13
|
|
|
|
|
97
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
with 'Web::Dispatch::ToApp'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
for (qw(match run)) { |
8
|
|
|
|
|
|
|
has "_${_}" => (is => 'ro', required => 1, init_arg => $_); |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub call { |
12
|
178
|
|
|
178
|
0
|
280
|
my ($self, $env) = @_; |
13
|
178
|
100
|
|
|
|
680
|
if (my ($env_delta, @match) = $self->_match->($env)) { |
14
|
92
|
|
|
|
|
237
|
($env_delta, $self->_curry(@match)); |
15
|
|
|
|
|
|
|
} else { |
16
|
|
|
|
|
|
|
() |
17
|
86
|
|
|
|
|
355
|
} |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _curry { |
21
|
92
|
|
|
92
|
|
143
|
my ($self, @args) = @_; |
22
|
92
|
|
|
|
|
212
|
my $run = $self->_run; |
23
|
92
|
|
|
92
|
|
322
|
my $code = sub { $run->(@args, $_[0]) }; |
|
92
|
|
|
|
|
272
|
|
24
|
|
|
|
|
|
|
# if the first argument is a hashref, localize %_ to it to permit |
25
|
|
|
|
|
|
|
# use of $_{name} inside the dispatch sub |
26
|
|
|
|
|
|
|
ref($args[0]) eq 'HASH' |
27
|
92
|
100
|
|
7
|
|
505
|
? do { my $v = $args[0]; sub { local *_ = $v; &$code } } |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
52
|
|
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
20
|
|
28
|
|
|
|
|
|
|
: $code |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |