line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Path::Dispatcher::Rule::Dispatch; |
2
|
|
|
|
|
|
|
# ABSTRACT: redispatch |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.08'; |
5
|
|
|
|
|
|
|
|
6
|
31
|
|
|
31
|
|
233
|
use Moo; |
|
31
|
|
|
|
|
68
|
|
|
31
|
|
|
|
|
184
|
|
7
|
31
|
|
|
31
|
|
10903
|
use MooX::TypeTiny; |
|
31
|
|
|
|
|
76
|
|
|
31
|
|
|
|
|
171
|
|
8
|
31
|
|
|
31
|
|
22329
|
use Type::Utils qw(class_type); |
|
31
|
|
|
|
|
70
|
|
|
31
|
|
|
|
|
226
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'Path::Dispatcher::Rule'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has dispatcher => ( |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
isa => class_type("Path::Dispatcher"), |
15
|
|
|
|
|
|
|
required => 1, |
16
|
|
|
|
|
|
|
handles => ['rules', 'complete'], |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub match { |
20
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
21
|
0
|
|
|
|
|
|
my $path = shift; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $dispatch = $self->dispatcher->dispatch($path); |
24
|
0
|
|
|
|
|
|
return $dispatch->matches; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
28
|
31
|
|
|
31
|
|
20306
|
no Moo; |
|
31
|
|
|
|
|
74
|
|
|
31
|
|
|
|
|
132
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=pod |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=encoding UTF-8 |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Path::Dispatcher::Rule::Dispatch - redispatch |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 VERSION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
version 1.08 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SYNOPSIS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $dispatcher = Path::Dispatcher->new( |
49
|
|
|
|
|
|
|
rules => [ |
50
|
|
|
|
|
|
|
Path::Dispatcher::Rule::Tokens->new( |
51
|
|
|
|
|
|
|
tokens => [ 'help' ], |
52
|
|
|
|
|
|
|
block => sub { show_help }, |
53
|
|
|
|
|
|
|
), |
54
|
|
|
|
|
|
|
Path::Dispatcher::Rule::Tokens->new( |
55
|
|
|
|
|
|
|
tokens => [ 'quit' ], |
56
|
|
|
|
|
|
|
block => sub { exit }, |
57
|
|
|
|
|
|
|
), |
58
|
|
|
|
|
|
|
], |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $rule = Path::Dispatcher::Rule::Dispatch->new( |
62
|
|
|
|
|
|
|
dispatcher => $dispatcher, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
$rule->run("help"); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 DESCRIPTION |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Rules of this class use another dispatcher to match the path. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 dispatcher |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
A L<Path::Dispatcher> object. Its matches will be returned by matching this |
76
|
|
|
|
|
|
|
rule. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SUPPORT |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Path-Dispatcher> |
81
|
|
|
|
|
|
|
(or L<bug-Path-Dispatcher@rt.cpan.org|mailto:bug-Path-Dispatcher@rt.cpan.org>). |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Shawn M Moore, C<< <sartak at bestpractical.com> >> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Shawn M Moore. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
92
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |