use strict;
use base qw/Catalyst::DispatchType/;
+use Text::ASCIITable;
=head1 NAME
=over 4
+=item $self->list($c)
+
+=cut
+
+sub list {
+ my ( $self, $c ) = @_;
+ my $paths = Text::ASCIITable->new;
+ $paths->setCols( 'Public', 'Private' );
+ $paths->setColWidth( 'Public', 36, 1 );
+ $paths->setColWidth( 'Private', 37, 1 );
+ for my $path ( sort keys %{ $self->{paths} } ) {
+ my $action = $self->{paths}->{$path};
+ $paths->addRow( "/$path", "/$action" );
+ }
+ $c->log->debug( "Loaded Path actions:\n" . $paths->draw )
+ if ( @{ $paths->{tbl_rows} } );
+}
+
=item $self->match( $c, $path )
=cut
use strict;
use base qw/Catalyst::DispatchType::Path/;
+use Text::ASCIITable;
=head1 NAME
=over 4
+=item $self->list($c)
+
+=cut
+
+sub list {
+ my ( $self, $c ) = @_;
+ my $re = Text::ASCIITable->new;
+ $re->setCols( 'Regex', 'Private' );
+ $re->setColWidth( 'Regex', 36, 1 );
+ $re->setColWidth( 'Private', 37, 1 );
+ for my $regex ( @{ $self->{compiled} } ) {
+ my $compiled = $regex->{re};
+ my $action = $regex->{action};
+ $re->addRow( $compiled, "/$action" );
+ }
+ $c->log->debug( "Loaded Regex actions:\n" . $re->draw )
+ if ( @{ $re->{tbl_rows} } );
+}
+
=item $self->match( $c, $path )
=cut
};
$walker->( $walker, $self->tree, '' );
- $class->log->debug( "Loaded private actions:\n" . $privates->draw )
+ $class->log->debug( "Loaded Private actions:\n" . $privates->draw )
if ( @{ $privates->{tbl_rows} } );
- my $publics = Text::ASCIITable->new;
- $publics->setCols( 'Public', 'Private' );
- $publics->setColWidth( 'Public', 36, 1 );
- $publics->setColWidth( 'Private', 37, 1 );
-
- for my $plain ( sort keys %{ $actions->{plain} } ) {
- my $action = $actions->{plain}->{$plain};
- $publics->addRow( "/$plain", "/$action" );
- }
-
- $class->log->debug( "Loaded public actions:\n" . $publics->draw )
- if ( @{ $publics->{tbl_rows} } );
-
- my $regexes = Text::ASCIITable->new;
- $regexes->setCols( 'Regex', 'Private' );
- $regexes->setColWidth( 'Regex', 36, 1 );
- $regexes->setColWidth( 'Private', 37, 1 );
-
- for my $regex ( sort keys %{ $actions->{regex} } ) {
- my $action = $actions->{regex}->{$regex};
- $regexes->addRow( $regex, "/$action" );
- }
-
- $class->log->debug( "Loaded regex actions:\n" . $regexes->draw )
- if ( @{ $regexes->{tbl_rows} } );
+ # List all public actions
+ $_->list($class) for @{ $self->dispatch_types };
}
=back