X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=82f109223c31e551b2342163937065654f08f3b9;hb=57221a474fe5ae3496cbda08ac7dd67508253861;hp=3b4b758906ca6b3ae90d8f6f55b467f3c944c238;hpb=c679d24243fa5c592d42afa6c6628c1182944bac;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 3b4b758..82f1092 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -356,15 +356,20 @@ sub get_action { my $result = $c->actions->{private}->{ $parent->getUID }->{$action}; push @results, [$result] if $result; my $visitor = Tree::Simple::Visitor::FindByPath->new; + my $local; for my $part ( split '/', $namespace ) { + $local = undef; $visitor->setSearchPath($part); $parent->accept($visitor); my $child = $visitor->getResult; my $uid = $child->getUID if $child; my $match = $c->actions->{private}->{$uid}->{$action} if $uid; + return [ [$match] ] if ( $match && $match =~ /^?.*/ ); + $local = $c->actions->{private}->{$uid}->{"?$action"} if $uid; push @results, [$match] if $match; $parent = $child if $child; } + return [ [$local] ] if $local; return \@results; } elsif ( my $p = $c->actions->{plain}->{$action} ) { return [ [$p] ] } @@ -482,8 +487,8 @@ sub prepare { } $c->prepare_request($r); $c->prepare_path; - $c->prepare_headers; $c->prepare_cookies; + $c->prepare_headers; $c->prepare_connection; my $method = $c->req->method || ''; my $path = $c->req->path || ''; @@ -670,7 +675,6 @@ Set an action in a given namespace. sub set_action { my ( $c, $action, $code, $namespace ) = @_; - my $prefix = ''; if ( $action =~ /^\?(.*)$/ ) { my $prefix = $1 || ''; @@ -678,7 +682,7 @@ sub set_action { $action = $prefix . _prefix( $namespace, $action ); $c->actions->{plain}->{$action} = [ $namespace, $code ]; } - if ( $action =~ /^\/(.*)\/$/ ) { + elsif ( $action =~ /^\/(.*)\/$/ ) { my $regex = $1; $c->actions->{compiled}->{qr#$regex#} = $action; $c->actions->{regex}->{$action} = [ $namespace, $code ]; @@ -704,15 +708,10 @@ sub set_action { $c->actions->{private}->{$uid}->{$action} = [ $namespace, $code ]; $action = "!$action"; } - else { - $c->actions->{plain}->{$action} = [ $namespace, $code ]; - } - + else { $c->actions->{plain}->{$action} = [ $namespace, $code ] } my $reverse = $prefix ? "$action ($prefix)" : $action; $c->actions->{reverse}->{"$code"} = $reverse; - - $c->log->debug(qq/"$namespace" defined "$action" as "$code"/) - if $c->debug; + $c->log->debug(qq/"$namespace" defined "$action" as "$code"/) if $c->debug; } =item $class->setup @@ -791,6 +790,7 @@ sub stash { sub _prefix { my ( $class, $name ) = @_; my $prefix = _class2prefix($class); + warn "$class - $name - $prefix"; $name = "$prefix/$name" if $prefix; return $name; }