@@ -5,32 +5,35 @@ package Plack::Middleware::Debug::Dancer::Routes;
5
5
use strict;
6
6
use warnings;
7
7
use parent qw( Plack::Middleware::Debug::Base) ;
8
- use Dancer::Session;
9
8
10
9
sub run {
11
10
my ( $self , $env , $panel ) = @_ ;
12
11
13
12
return sub {
14
- my $routes = Dancer::Route::Registry-> routes();
15
- my $hash_routes ;
16
-
17
- foreach my $method ( keys %$routes ) {
18
- map {
19
- my $name = $_ -> {method } . ' ' . $_ -> {route };
20
- $hash_routes -> {$name } = {
21
- method => $_ -> {method },
22
- options => $_ -> {options },
23
- params => $_ -> {params },
24
- route => $_ -> {route }
25
- };
26
- } @{ $routes -> {$method } };
13
+ my $hash_routes = {};
14
+ foreach my $app ( Dancer::App-> applications ) {
15
+ my $routes = $app -> {registry }-> {routes };
16
+ foreach my $method (keys %$routes ) {
17
+ foreach (@{$routes -> {$method }}) {
18
+ $hash_routes -> {$method }-> {$_ -> {_compiled_regexp }} = $_ -> {_params };
19
+ }
20
+ }
21
+ # map {
22
+ # my $name = $_->{method} . ' ' . $_->{route};
23
+ # $hash_routes->{$name} = {
24
+ # method => $_->{method},
25
+ # options => $_->{options},
26
+ # params => $_->{params},
27
+ # route => $_->{route}
28
+ # };
29
+ # } @{ $routes->{$method} };
27
30
}
28
31
29
32
$panel -> title(' Dancer::Route' );
30
33
$panel -> nav_subtitle(
31
34
" Dancer::Route (" . ( keys %$hash_routes ) . " )" );
32
35
$panel -> content(
33
- sub { $self -> render_hash( $hash_routes , [ keys %$hash_routes ] ) }
36
+ sub { $self -> render_hash( $hash_routes , [keys %$hash_routes ] ) }
34
37
);
35
38
};
36
39
}
0 commit comments