From: Alexander Hartmaier Date: Thu, 9 Jan 2014 16:28:29 +0000 (+0100) Subject: use Catalyst's http method matching for REST X-Git-Tag: 2.005001~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=26e9dcd6d31111877fd0b97f5c6743fab226e015;hp=e48e272a0d2ace68c32ee86e7ffec0844e5d19bf;p=catagits%2FCatalyst-Controller-DBIC-API.git 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 --- diff --git a/Changes b/Changes index a1e7036..996a908 100644 --- 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 diff --git a/dist.ini b/dist.ini index b5d4b63..7b5b735 100644 --- 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 diff --git a/lib/Catalyst/Controller/DBIC/API.pm b/lib/Catalyst/Controller/DBIC/API.pm index d45962b..7db1d8c 100644 --- a/lib/Catalyst/Controller/DBIC/API.pm +++ b/lib/Catalyst/Controller/DBIC/API.pm @@ -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; diff --git a/lib/Catalyst/Controller/DBIC/API/REST.pm b/lib/Catalyst/Controller/DBIC/API/REST.pm index d615b8a..df58115 100644 --- a/lib/Catalyst/Controller/DBIC/API/REST.pm +++ b/lib/Catalyst/Controller/DBIC/API/REST.pm @@ -47,7 +47,7 @@ Calls L. =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. =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. =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. =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. =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. =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);