use Catalyst's http method matching for REST
Alexander Hartmaier [Thu, 9 Jan 2014 16:28:29 +0000 (17:28 +0100)]
instead of ActionRole, whose feature went into core in 5.90013, and
MatchRequestMethod, whose feature went into 5.90020

Changes
dist.ini
lib/Catalyst/Controller/DBIC/API.pm
lib/Catalyst/Controller/DBIC/API/REST.pm

diff --git a/Changes b/Changes
index a1e7036..996a908 100644 (file)
--- a/Changes
+++ b/Changes
@@ -2,6 +2,9 @@ Revision history for Catalyst-Controller-DBIC-API: {{ $dist->version }}
 
 {{ $NEXT }}
 - Fixed test failures with JSON 2.90 (thanks Samuel Kaufman!)
+- Use Catalyst's http method matching for REST instead of
+  ActionRole, whose feature went into core in 5.90013, and
+  MatchRequestMethod, whose feature went into 5.90020
 
 2.004004  2012-11-21 12:20:41 Europe/Vienna
 - Fixed test failures in t/[rest,rpc]/item.t on newer HTTP::Message versions
index b5d4b63..7b5b735 100644 (file)
--- a/dist.ini
+++ b/dist.ini
@@ -37,9 +37,7 @@ repository.web = http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits/Catalys
 [Prereqs]
 perl = 5.008006
 DBIx::Class = 0.08103
-Catalyst::Runtime = 5.7010
-Catalyst::Controller::ActionRole = 0
-Catalyst::ActionRole::MatchRequestMethod = 0
+Catalyst::Runtime = 5.90020
 Catalyst::Action::Serialize = 0.83
 CGI::Expand = 2.02
 JSON = 2.50
index d45962b..7db1d8c 100644 (file)
@@ -2,7 +2,7 @@ package Catalyst::Controller::DBIC::API;
 
 #ABSTRACT: Provides a DBIx::Class web service automagically
 use Moose;
-BEGIN { extends 'Catalyst::Controller::ActionRole'; }
+BEGIN { extends 'Catalyst::Controller'; }
 
 use CGI::Expand ();
 use DBIx::Class::ResultClass::HashRefInflator;
index d615b8a..df58115 100644 (file)
@@ -47,7 +47,7 @@ Calls L<Catalyst::Controller::DBIC::API/update_or_create>.
 
 =cut
 
-sub update_or_create_objects : Chained('objects_no_id') PathPart('') Does('MatchRequestMethod') Method('POST') Method('PUT') Args(0)
+sub update_or_create_objects : POST PUT Chained('objects_no_id') PathPart('') Args(0)
 {
        my ( $self, $c ) = @_;
     $self->update_or_create($c);
@@ -64,7 +64,7 @@ Calls L<Catalyst::Controller::DBIC::API/delete>.
 
 =cut
 
-sub delete_many_objects : Chained('objects_no_id') PathPart('') Does('MatchRequestMethod') Method('DELETE') Args(0)
+sub delete_many_objects : DELETE Chained('objects_no_id') PathPart('') Args(0)
 {
        my ( $self, $c ) = @_;
     $self->delete($c);
@@ -81,7 +81,7 @@ Calls L<Catalyst::Controller::DBIC::API/list>.
 
 =cut
 
-sub list_objects : Chained('objects_no_id') PathPart('') Does('MatchRequestMethod') Method('GET') Args(0)
+sub list_objects : GET Chained('objects_no_id') PathPart('') Args(0)
 {
        my ( $self, $c ) = @_;
     $self->list($c);
@@ -98,7 +98,7 @@ Calls L<Catalyst::Controller::DBIC::API/update_or_create>.
 
 =cut
 
-sub update_or_create_one_object : Chained('object_with_id') PathPart('') Does('MatchRequestMethod') Method('POST') Method('PUT') Args(0)
+sub update_or_create_one_object : POST PUT Chained('object_with_id') PathPart('') Args(0)
 {
        my ( $self, $c ) = @_;
     $self->update_or_create($c);
@@ -115,7 +115,7 @@ Calls L<Catalyst::Controller::DBIC::API/delete>.
 
 =cut
 
-sub delete_one_object : Chained('object_with_id') PathPart('') Does('MatchRequestMethod') Method('DELETE') Args(0)
+sub delete_one_object : DELETE Chained('object_with_id') PathPart('') Args(0)
 {
        my ( $self, $c ) = @_;
     $self->delete($c);
@@ -132,7 +132,7 @@ Calls L<Catalyst::Controller::DBIC::API/item>.
 
 =cut
 
-sub list_one_object : Chained('object_with_id') PathPart('') Does('MatchRequestMethod') Method('GET') Args(0)
+sub list_one_object : GET Chained('object_with_id') PathPart('') Args(0)
 {
        my ( $self, $c ) = @_;
     $self->item($c);