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=f6d060637602179b7b72d03295eac7634bac0e15;hp=af9a11a17a05e7927409f744e6f112954fe039f8;hb=4090e3bb3fea1a73ac369250e31584d61428b808;hpb=3c0186f29e8864c86aca75f03f8d8ac1afd5507d diff --git a/lib/Catalyst/DispatchType/Regex.pm b/lib/Catalyst/DispatchType/Regex.pm index af9a11a..f6d0606 100644 --- a/lib/Catalyst/DispatchType/Regex.pm +++ b/lib/Catalyst/DispatchType/Regex.pm @@ -2,10 +2,18 @@ package Catalyst::DispatchType::Regex; use Moose; extends 'Catalyst::DispatchType::Path'; + use Text::SimpleTable; use Text::Balanced (); -has _compiled => (is => 'rw', isa => 'ArrayRef', required => 1, default => sub{[]}); +has _compiled => ( + is => 'rw', + isa => 'ArrayRef', + required => 1, + default => sub{ [] }, + ); + +no Moose; =head1 NAME @@ -27,14 +35,13 @@ Output a table of all regex actions, and their private equivalent. sub list { my ( $self, $c ) = @_; - my @regexes = @{ $self->_compiled }; - return unless @regexes; my $re = Text::SimpleTable->new( [ 35, 'Regex' ], [ 36, 'Private' ] ); - for my $regex ( @regexes ) { + for my $regex ( @{ $self->_compiled } ) { my $action = $regex->{action}; $re->row( $regex->{path}, "/$action" ); } - $c->log->debug( "Loaded Regex actions:\n" . $re->draw . "\n" ); + $c->log->debug( "Loaded Regex actions:\n" . $re->draw . "\n" ) + if ( @{ $self->_compiled } ); } =head2 $self->match( $c, $path ) @@ -46,10 +53,10 @@ altering $c. =cut -override match => sub { +sub match { my ( $self, $c, $path ) = @_; - return if super(); + return if $self->SUPER::match( $c, $path ); # Check path against plain text first @@ -154,4 +161,6 @@ the same terms as Perl itself. =cut +__PACKAGE__->meta->make_immutable; + 1;