Catalyst::Enzyme::CRUD::Controller - CRUD Controller Base Class with CRUD support
See Catalyst::Enzyme
The model class, overloaded by you in each controller class to return the actual class name for the Model this controller should handle.
So in your Controller classes, something like this is recommended:
sub model_class { return("BookShelf::Model::BookShelfDB::Genre"); }
These are the default CRUD actions.
You should read the source so you know what the actions do, and how you can adjust or block them in your own code.
They also deal with form validation, messages, and errors in a certain way that you could use (or not, you may have a better way) in your own Controller actions.
Set up the default model and class for this Controller
Forward to list.
Display list template
Select a row and display view template.
Display add template
Add a new row and redirect to list.
Display edit template.
Edit a row and redirect to edit.
Destroy row and forward to list.
Return hash ref with a default Data::FormValidator config.
Run the $sub->(@rest) ref inside an eval cage, and return 1.
Or, if $sub dies, set stash->{message} to $fail_message, stash->{error} to $@, log the error, shed a tear, and return 0.
Set the Model class and it's configuration for the Controller using the model_class().
Point $self->crud_config to the Model's config->{crud}. Set crud_config keys:
model_class model moniker (default) rows_per_page (default 20) column_monikers (default)
Return 1.
Return hash ref with config values form the Model class' config->{crud} (so model_class needs to be set).
Return default moniker of $class_name.
Default is to take the last past of the $class_name, and split it on lower/uppercase boundaries.
If one can't be figured out, return the $class_name.
Return either the current model class, or (if $rows_per_page > 0) a pager for the current model class. $page indicates which page to display in the pager (default to the first page).
Assign the pager to $c->stash->{pager}.
The Model class (or it's base class) must use Class::DBI::Pager.
use Class::DBI::Pager
Johan Lindstrom <johanl ÄT cpan.org>
This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'ÄT'. Assuming CP1252
To install Catalyst::Enzyme, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Enzyme
CPAN shell
perl -MCPAN -e shell install Catalyst::Enzyme
For more information on module installation, please visit the detailed CPAN module installation guide.