if ( my $p = $self->actions->{plain}->{$action} ) { return [$p] }
elsif ( my $r = $self->actions->{regex}->{$action} ) { return [$r] }
else {
- while ( my ( $regex, $name ) =
- each %{ $self->actions->{compiled} } )
- {
+ for my $regex ( keys %{ $self->actions->{compiled} } ) {
+ my $name = $self->actions->{compiled}->{$regex};
if ( $action =~ $regex ) {
my @snippets;
for my $i ( 1 .. 9 ) {
last unless ${$i};
push @snippets, ${$i};
}
- return [ $name, \@snippets ];
+ return [ $self->actions->{regex}->{$name},
+ $name, \@snippets ];
}
}
}
return wantarray ? ( $elapsed, @return ) : $elapsed;
}
-=head3 component (comp)
+=head3 component / comp
Get a component object by name.
}
my ( $class, $code );
if ( my $action = $c->action($command) ) {
+ if ( $action->[2] ) {
+ $c->log->debug(qq/Couldn't forward "$command" to regex action/)
+ if $c->debug;
+ return 0;
+ }
( $class, $code ) = @{ $action->[0] };
}
else {
}
$c->prepare_request($r);
$c->prepare_path;
- my $path = $c->request->path;
- $c->log->debug(qq/Requested path "$path"/) if $c->debug;
$c->prepare_cookies;
$c->prepare_headers;
+ my $method = $c->req->method;
+ my $path = $c->req->path;
+ $c->log->debug(qq/"$method" request for "$path"/) if $c->debug;
$c->prepare_action;
$c->prepare_parameters;
$c->prepare_uploads;
# It's a regex
if ($#$result) {
- my $match = $result->[0];
- my @snippets = @{ $result->[1] };
+ my $match = $result->[1];
+ my @snippets = @{ $result->[2] };
$c->log->debug(qq/Requested action "$path" matched "$match"/)
if $c->debug;
$c->log->debug(
$c->log->debug(qq/Requested action "$path"/) if $c->debug;
}
$c->req->match($path);
- $c->log->debug( 'Arguments are "' . join( '/', @args ) . '"' )
- if ( $c->debug && @args );
last;
}
unshift @args, pop @path;
$c->log->debug('Using default action') if $c->debug;
}
}
+ $c->log->debug( 'Arguments are "' . join( '/', @args ) . '"' )
+ if ( $c->debug && @args );
}
=head3 prepare_cookies;