Merge branch 'master' into roles-saner
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Request / REST.pm
1 #
2 # REST.pm
3 # Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
4 # Created on: 10/13/2006 03:54:33 PM PDT
5 #
6 # $Id: $
7
8 package Catalyst::Request::REST;
9
10 use strict;
11 use warnings;
12
13 use Moose;
14 extends qw/Catalyst::Request/;
15 with qw/Catalyst::RequestRole::REST Catalyst::RequestRole::Deserialize/;
16
17 use Catalyst::Utils;
18
19 sub _insert_self_into {
20   my ($class, $app_class ) = @_;
21   # the fallback to $app_class is for the (rare and deprecated) case when
22   # people are defining actions in MyApp.pm instead of in a controller.
23   my $app = Catalyst::Utils::class2appclass( $app_class ) || $app_class;
24
25   my $req_class = $app->request_class;
26   return if $req_class->isa($class);
27   if ($req_class eq 'Catalyst::Request') {
28     $app->request_class($class);
29   } else {
30     die "$app has a custom request class $req_class, "
31       . "which is not a $class; see Catalyst::Request::REST";
32   }
33 }
34
35 =head1 NAME
36
37 Catalyst::Request::REST - A REST-y subclass of Catalyst::Request
38
39 =head1 AUTHOR
40
41 Adam Jacob <adam@stalecoffee.org>, with lots of help from mst and jrockway
42
43 =head1 MAINTAINER
44
45 J. Shirley <jshirley@cpan.org>
46
47 =head1 LICENSE
48
49 You may distribute this code under the same terms as Perl itself.
50
51 =cut
52
53 1;