Catalyst::Helper::Controller::Scaffold::HTML::Template - Helper for Scaffolding using HTML::Template.
# Imagine you want to generate a scaffolding controller MyApp::C::SomeTable # for a CDBI table class MyApp::M::CDBI::SomeTable script/myapp_create.pl controller SomeTable Scaffold::HTML::Template CDBI::SomeTable
This module is heavily based on Catalyst::Helper::Controller::Scaffold. It provides a framework to do the basic data operations (edit, view, list, delete, add).
Scaffolding is very simple with Catalyst, as most of the code will be automagically generated to handle the basic operations.
Let's say you want to handle the data in SomeTable, all you have to do is :
script/myapp_create.pl controller SomeTable Scaffold::HTML::Template CDBI::SomeTable
this will create a controller for SomeTable using the model CDBI::SomeTable and all the required HTML::Template, namely :
lib/myapp/C/SomeTable.pm root/SomeTable/add.tmpl root/SomeTable/edit.tmpl root/SomeTable/list.tmpl root/SomeTable/view.tmpl
Now just add these lines to your CDBI class...
use Class::DBI::AsForm; use Class::DBI::FromForm;
...and modify the one in your application class, to load the FormValidator plugin.
use Catalyst qw/-Debug FormValidator/;
You're done !
Just browse http://127.0.0.1:3000/sometable and enjoy the Catalyst's power : You can now add elements in SomeTable, view them, modify them, list them and delete them.
mk_compclass now accept a hashref as its last argument. This hash can be used to overrides all $helper attributes before calling its mk_dir and render_file methods
Sebastian Riedel, Arnaud Assad
This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.
[% class %] - Scaffolding Controller Component
See "[% app %]"
Scaffolding Controller Component.
Sets a template.
Forwards to list.
Destroys a row and forwards to list.
Adds a new row to the table and forwards to list.
Edits a row and forwards to edit.
Fetches a row and sets a template.
[% author %]
To install Catalyst::Helper::Controller::Scaffold::HTML::Template, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Helper::Controller::Scaffold::HTML::Template
CPAN shell
perl -MCPAN -e shell install Catalyst::Helper::Controller::Scaffold::HTML::Template
For more information on module installation, please visit the detailed CPAN module installation guide.