[Catalyst] Catalyst::Action::REST

Adam Jacob adam at stalecoffee.org
Mon Nov 20 08:00:34 GMT 2006


After much discussion, I've unleased Catalyst::Action::REST upon an
unsuspecting CPAN.  It's an attempt at making RESTful web applications
in Catalyst easier (they were already pretty easy.) The basics:

1) Uses an Action class to extend Catalyst's dispatch mechanism to allow
for different methods based on the HTTP Method.  For example:

sub foo :Local :ActionClass('REST') {}

sub foo_GET {}

sub foo_POST {}

sub foo_DELETE {}

2) Handles serializing and deserializing data based on the content type
of the request.  Currently only YAML and Data::Dumper are implemented,
but it's easy to add more. (XML, anyone?)

3) Wraps those parts together in a Catalyst::Controller::REST, so you
don't have to. :)  The Controller base class also includes helper
methods for returning the various HTTP Result Codes (and their proper
attending headers and bodies.) 

The code is still pretty early in it's development.  It's working great
for me, but there are certainly still areas for improvement.  At the
very least, I think it's a good starting place for those of us doing
REST app's in Catalyst to collaborate.

On the CPAN:

http://search.cpan.org/~holoway/Catalyst-Action-REST-0.1/

If you have any questions, comments, patches, flames, or beer, you can
usually find me as holoway on #catalyst. 

The all important shout-out goes to mst and jrockway, who helped more
than considerably with the design. (But all the bugs, I assure you, are
mine.)

Adam



More information about the Catalyst mailing list