Initial commit of Catalyst-Action-REST
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / REST.pm
CommitLineData
256c894f 1#
2# REST.pm
3# Created by: Adam Jacob, Marchex, <adam@marchex.com>
4# Created on: 10/12/2006 03:00:32 PM PDT
5#
6# $Id$
7
8package Catalyst::Action::REST;
9
10use strict;
11use warnings;
12
13use base 'Catalyst::Action';
14
15sub dispatch {
16 my ( $self, $c ) = @_;
17
18 my $controller = $self->class;
19 my $method = $self->name . "_" . uc($c->request->method);
20 if ($controller->can($method)) {
21 $c->log->debug("REST ActionClass is calling $method");
22 return $controller->$method($c);
23 } else {
24 $c->log->debug("REST ActionClass is calling " . $self->name);
25 return $c->execute( $self->class, $self );
26 }
27}
28
291;