Expose _get_allowed_methods to the API wreis/options_response mirror/wreis/options_response
Wallace Reis [Thu, 21 Jun 2012 20:05:54 +0000 (22:05 +0200)]
Then child controllers can use that to write their own _not_implemented
methods.

lib/Catalyst/Action/REST.pm

index 11f27e2..907243b 100644 (file)
@@ -133,7 +133,7 @@ sub _dispatch_rest_method {
     $c->execute( $self->class, $self, @{ $c->req->args } );
 }
 
-sub _get_allowed_methods {
+sub get_allowed_methods {
     my ( $self, $controller, $c, $name ) = @_;
     my $class = ref($controller) ? ref($controller) : $controller;
     my $methods = Class::Inspector->methods($class);
@@ -142,7 +142,7 @@ sub _get_allowed_methods {
 
 sub _return_options {
     my ( $self, $method_name, $controller, $c) = @_;
-    my @allowed = $self->_get_allowed_methods($controller, $c, $method_name);
+    my @allowed = $self->get_allowed_methods($controller, $c, $method_name);
     $c->response->content_type('text/plain');
     $c->response->status(200);
     $c->response->header( 'Allow' => \@allowed );
@@ -152,7 +152,7 @@ sub _return_options {
 sub _return_not_implemented {
     my ( $self, $method_name, $controller, $c ) = @_;
 
-    my @allowed = $self->_get_allowed_methods($controller, $c, $method_name);
+    my @allowed = $self->get_allowed_methods($controller, $c, $method_name);
     $c->response->content_type('text/plain');
     $c->response->status(405);
     $c->response->header( 'Allow' => \@allowed );