X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FAction%2FREST.pm;h=6323dae438be6ca20c33e1ce5d60e4452e3a89be;hb=d0822465cc09629df95ad9c522bce758f2badc8c;hp=fd1278f1a84e7077b8ef1307d91660b4d0529383;hpb=29f9721bfe883351594c7d664e3778a36ceaeb27;p=catagits%2FCatalyst-Action-REST.git diff --git a/lib/Catalyst/Action/REST.pm b/lib/Catalyst/Action/REST.pm index fd1278f..6323dae 100644 --- a/lib/Catalyst/Action/REST.pm +++ b/lib/Catalyst/Action/REST.pm @@ -10,7 +10,7 @@ use Catalyst::Controller::REST; BEGIN { require 5.008001; } -our $VERSION = '0.94'; +our $VERSION = '1.02'; $VERSION = eval $VERSION; sub BUILDARGS { @@ -99,14 +99,14 @@ sub _dispatch_rest_method { my ($code, $name); + # Execute normal 'foo' action. + $c->execute( $self->class, $self, @{ $c->req->args } ); + # Common case, for foo_GET etc if ( $code = $controller->action_for($rest_method) ) { - $c->execute( $self->class, $self, @{ $c->req->args } ); # Execute normal 'foo' action. return $c->forward( $code, $c->req->args ); # Forward to foo_GET if it's an action } elsif ($code = $controller->can($rest_method)) { - # Execute normal action - $c->execute( $self->class, $self, @{ $c->req->args } ); $name = $rest_method; # Stash name and code to run 'foo_GET' like an action below. } @@ -127,8 +127,11 @@ sub _dispatch_rest_method { # localise stuff so we can dispatch the action 'as normal, but get # different stats shown, and different code run. + # Also get the full path for the action, and make it look like a forward local $self->{code} = $code; - local $self->{reverse} = $name; + my @name = split m{/}, $self->reverse; + $name[-1] = $name; + local $self->{reverse} = "-> " . join('/', @name); $c->execute( $self->class, $self, @{ $c->req->args } ); } @@ -224,9 +227,15 @@ Arthur Axel "fREW" Schmidt Efrioux@gmail.comE J. Shirley Ejshirley@gmail.comE +Gavin Henry Eghenry@surevoip.co.ukE + +Gerv http://www.gerv.net/ + +Colin Newell + =head1 COPYRIGHT -Copyright (c) 2006-2011 the above named AUTHOR and CONTRIBUTORS +Copyright (c) 2006-2012 the above named AUTHOR and CONTRIBUTORS =head1 LICENSE