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
Gets/sets the entity data used for RESTish requests and responses.
Returns true if the client is requesting an atom feed.
Returns true if the client is requesting a feed (atom/rss).
Returns true if the client is requesting an rss feed.
Returns true if the client appears to be a a web browser and/or is requesting html-like resources.
Returns true if the client is requesting html.
Returns true if the client is requesting xhtml.
Returns true if the client is requesting json.
Returns true if the client is requesting yaml.
Returns true if the client is requesting text.
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.