r1144@mbp: claco | 2008-01-03 19:43:42 -0500
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / REST.pm
index 0bd3fb7..9cb5a78 100644 (file)
@@ -12,10 +12,18 @@ use warnings;
 
 use base 'Catalyst::Action';
 use Class::Inspector;
+use Catalyst;
+use Catalyst::Request::REST;
 use 5.8.1;
 
 our
-$VERSION = '0.30';
+   $VERSION = '0.60';
+
+# This is wrong in several ways. First, there's no guarantee that
+# Catalyst.pm has not been subclassed. Two, there's no guarantee that
+# the user isn't already using their request subclass.
+Catalyst->request_class('Catalyst::Request::REST')
+  unless Catalyst->request_class->isa('Catalyst::Request::REST');
 
 =head1 NAME
 
@@ -61,6 +69,9 @@ It is likely that you really want to look at L<Catalyst::Controller::REST>,
 which brings this class together with automatic Serialization of requests
 and responses.
 
+When you use this module, the request class will be changed to
+L<Catalyst::Request::REST>.
+
 =head1 METHODS
 
 =over 4
@@ -76,7 +87,7 @@ sub dispatch {
     my $self = shift;
     my $c    = shift;
 
-    my $controller = $self->class;
+    my $controller = $c->component( $self->class );
     my $method     = $self->name . "_" . uc( $c->request->method );
     if ( $controller->can($method) ) {
         $c->execute( $self->class, $self, @{ $c->req->args } );