Mango::Catalyst::Controller::REST - Catalyst controller for REST based activity.
package MyApp::Controller::Stuff; use base qw/Mango::Catalyst:Controller::REST/; sub load : Local { my ($self, $c, $id) = @_; my $user = $c->model('Users')->get_by_id($id); $c->stash->{'entity'} = $user; }; http://localhost/user/1?view=json
Mango::Catalyst::Controller::REST is a base Catalyst controller that automatically enables REST activity on actions in that controller using Catalyst::Action::REST.
By default, REST looks for data in the entity stash key, for forwards to the appropriate view based on the Content-Type header, or the view parameter.
entity
view
In addition to the formats supported by Catalyst::Action;:REST, the following has been added:
Content-Type: 'text/plain' => [qw/View Text/], 'text/html' => [qw/View HTML/], 'application/xhtml+xml' => [qw/View XHTML/], 'application/rss+xml' => [qw/View RSS/], 'application/atom+xml' => [qw/View Atom/], view parameter: txt, text => [qw/View Text/], htm, html => [qw/View HTML/], xhtml => [qw/View XHTML/], rss => [qw/View RSS/], atom => [qw/View Atom/], json => JSON yml, yaml => YAML
Catalyst::Action::REST
Christopher H. Laco CPAN ID: CLACO claco@chrislaco.com http://today.icantfocus.com/blog/
To install Mango, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mango
CPAN shell
perl -MCPAN -e shell install Mango
For more information on module installation, please visit the detailed CPAN module installation guide.