line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Router::Debug; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
636
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
57
|
|
5
|
2
|
|
|
2
|
|
1943
|
use Text::SimpleTable; |
|
2
|
|
|
|
|
12345
|
|
|
2
|
|
|
|
|
69
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT = qw(show_table routing_table); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
10
|
2
|
|
|
2
|
|
361
|
require HTTP::Router; |
11
|
2
|
|
|
2
|
|
50
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
586
|
|
12
|
2
|
|
|
|
|
6
|
for my $name (@EXPORT) { |
13
|
4
|
|
|
|
|
6
|
*{"HTTP::Router::$name"} = \&{$name}; |
|
4
|
|
|
|
|
1758
|
|
|
4
|
|
|
|
|
11
|
|
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub show_table { |
18
|
0
|
|
|
0
|
1
|
0
|
my $table = $_[0]->routing_table->draw; |
19
|
0
|
|
|
|
|
0
|
print "$table\n"; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub routing_table { |
23
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
14
|
my $table = Text::SimpleTable->new( |
26
|
|
|
|
|
|
|
[qw(35 path) ], |
27
|
|
|
|
|
|
|
[qw(10 method) ], |
28
|
|
|
|
|
|
|
[qw(10 controller)], |
29
|
|
|
|
|
|
|
[qw(10 action) ], |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
149
|
for my $route ($self->routes) { |
33
|
0
|
|
|
|
|
0
|
my $method = $route->conditions->{method}; |
34
|
0
|
0
|
|
|
|
0
|
$method = [ $method ] unless ref $method; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
0
|
$table->row( |
37
|
|
|
|
|
|
|
$route->path, |
38
|
|
|
|
|
|
|
join(',', @$method), |
39
|
|
|
|
|
|
|
$route->params->{controller}, |
40
|
|
|
|
|
|
|
$route->params->{action} |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
5
|
return $table; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
HTTP::Router::Debug |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SYNOPSIS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
use HTTP::Router; |
56
|
|
|
|
|
|
|
use HTTP::Router::Debug; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $router = HTTP::Router->define(...); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
print $router->routing_table->draw; |
61
|
|
|
|
|
|
|
# or |
62
|
|
|
|
|
|
|
$router->show_table; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 METHODS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 routing_table |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Returns a Text::SimpleTable object for routing information. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 show_table |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Constructs and Prints a table for routing information. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Takatoshi Kitano Ekitano.tk@gmail.comE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
NAKAGAWA Masaki Emasaki@cpan.orgE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 LICENSE |
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 SEE ALSO |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
L, L |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |