CatalystX::CRUD::REST - REST-style controller for CRUD
# create a controller package MyApp::Controller::Foo; use strict; use base qw( CatalystX::CRUD::REST ); __PACKAGE__->config( form_class => 'MyForm::Foo', init_form => 'init_with_foo', init_object => 'foo_from_form', default_template => 'path/to/foo/edit.tt', model_name => 'Foo', primary_key => 'id', view_on_single_result => 0, page_size => 50, ); 1; # now you can manage Foo objects using your MyForm::Foo form class # with URIs at: # foo/<pk> # and use the HTTP method name to indicate the appropriate action. # POST /foo -> create new record # GET /foo -> list all records # PUT /foo/<pk> -> update record # DELETE /foo/<pk> -> delete record # GET /foo/<pk> -> view record # GET /foo/<pk>/edit_form -> edit record form # GET /foo/create_form -> create record form
CatalystX::CRUD::REST is a subclass of CatalystX::CRUD::Controller. Instead of calling RPC-style URIs, the REST API uses the HTTP method name to indicate the action to be taken.
See CatalystX::CRUD::Controller for more details on configuration.
The REST API is designed with identical configuration options as the RPC-style Controller API, so that you can simply change your @ISA chain and enable REST features for your application.
Acts just like edit() in base Controller class, but with a RESTful name.
Acts just like create() in base Controller class, but with a RESTful name.
Attribute: Private
Calls the appropriate method based on the HTTP method name.
Internal method. Returns the HTTP method name, allowing POST to serve as a tunnel when the _http_method param is present. Since most browsers do not support PUT or DELETE HTTP methods, you can use the _http_method param to tunnel the desired HTTP method and then POST instead.
_http_method
Overrides base method to disable chaining.
Peter Karman, <perl at peknet.com>
<perl at peknet.com>
Please report any bugs or feature requests to bug-catalystx-crud at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CatalystX-CRUD. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-catalystx-crud at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc CatalystX::CRUD
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/CatalystX-CRUD
CPAN Ratings
http://cpanratings.perl.org/d/CatalystX-CRUD
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=CatalystX-CRUD
Search CPAN
http://search.cpan.org/dist/CatalystX-CRUD
Copyright 2008 Peter Karman, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CatalystX::CRUD, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::CRUD
CPAN shell
perl -MCPAN -e shell install CatalystX::CRUD
For more information on module installation, please visit the detailed CPAN module installation guide.