X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FRegex.pm;h=a1224c594212cc4f65701bcf84de698af6c15381;hp=c373d2f83ed2a0c8857a09f3d6e2b34062b57a42;hb=11bd4e3eaa29685c44318041381621e79c4a5f44;hpb=2633d7dc3bb9c0cf7bf3e7cf936d6411fe3ba5aa diff --git a/lib/Catalyst/DispatchType/Regex.pm b/lib/Catalyst/DispatchType/Regex.pm index c373d2f..a1224c5 100644 --- a/lib/Catalyst/DispatchType/Regex.pm +++ b/lib/Catalyst/DispatchType/Regex.pm @@ -2,6 +2,7 @@ package Catalyst::DispatchType::Regex; use strict; use base qw/Catalyst::DispatchType::Path/; +use Text::ASCIITable; =head1 NAME @@ -17,6 +18,25 @@ See L. =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 @@ -34,7 +54,7 @@ sub match { $c->req->match($path); $c->req->snippets( \@snippets ); $c->action( $compiled->{action} ); - $c->namespace( $compiled->{action}->prefix ); + $c->namespace( $compiled->{action}->namespace ); return 1; } }