Plack/Middleware/Debug/Dancer/Routes.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 37 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
run
2.0
BEGIN
2.0
CRAP 2.0
1 package Plack::Middleware::Debug::Dancer::Routes;
2 BEGIN {
3 $Plack::Middleware::Debug::Dancer::Routes::VERSION = '0.03';
4 }
5  
6 # ABSTRACT: Show available and matched routes for your application
7  
8 use strict;
9 use warnings;
10 use parent qw(Plack::Middleware::Debug::Base);
11 use Dancer::Session;
12  
13 sub run {
14 my ( $self, $env, $panel ) = @_;
15  
16 return sub {
17 my $routes = Dancer::Route::Registry->routes();
18 my $hash_routes;
19  
20 foreach my $method ( keys %$routes ) {
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} };
30 }
31  
32 $panel->title('Dancer::Route');
33 $panel->nav_subtitle(
34 "Dancer::Route (" . ( keys %$hash_routes ) . ")" );
35 $panel->content(
36 sub { $self->render_hash( $hash_routes, [ keys %$hash_routes ] ) }
37 );
38 };
39 }
40  
41 1;
42  
43  
44 __END__