1 package Catalyst::DispatchType::Regex;
4 use base qw/Catalyst::DispatchType::Path/;
7 my ($self, $c, $path) = @_;
9 return if $self->SUPER::prepare_action($c, $path);
10 # Check path against plain text first
12 foreach my $compiled (@{$self->{compiled}||[]}) {
13 if ( my @snippets = ( $path =~ $compiled->{re} ) ) {
14 $c->req->action($compiled->{path});
15 $c->req->match($path);
16 $c->req->snippets(\@snippets);
17 $c->action($compiled->{action});
18 $c->namespace($compiled->{action}->prefix);
27 my ( $self, $c, $action ) = @_;
28 my $attrs = $action->attributes;
29 my @register = map { @{$_ || []} } @{$attrs}{'Regex', 'Regexp'};
30 foreach my $r (@register) {
31 $self->{paths}{$r} = $action; # Register path for superclass
32 push(@{$self->{compiled}}, # and compiled regex for us