Form::Processor::Model::DOD - Model Class for Form::Processor based on Data::ObjectDriver
Version 0.01
## define a form class to use with DOD items package MyApplication::Form::User; use strict; use base 'Form::Processor::Model::DOD'; # Associate this form with a L<Data::ObjectDriver::BaseObject> class sub object_class { 'MyApplication::Model::User' } sub profile { ... } 1;
This is a Form::Processor::Model add-on module. This module is for use with Data::ObjectDriver based objects. By declaring a object_class method in the Form class, a form is tied to the data in the database (typically a row in one table).
object_class
The form object can be prefilled with the data from the object in database, and similarily on update_from_form() the object can be inserted or updated in the database (If validation passes).
update_from_form()
(pod from cdbi model) This method is typically overridden in your form class and relates the form to a specific Class::DBI table class. This is the mapping between the form and the columns in the table the form operates on.
The module uses this information to lookup options in related tables for both select and multiple select (many-to-many) relationships.
If not defined will attempt to use the class of $form->item, if set.
Typically, this method is overridden as shown above, and is all you need to do to use this module. This can also be a parameter when creating a form instance.
By default, just lookup the item_id associated with that model in the database.
(some parts of this pod section come from cdbi)
my $ok = $form->update_from_form( $parameter_hash ); my $ok = $form->update_from_form( $c->request->parameters ); # catalyst for instance
Update or create the object from values in the form.
Validation is run unless validation has already been run. ($form->clear might need to be called if the $form object stays in memory between requests.)
Pass in hash reference of parameters.
Returns false if form does not validate. Very likely dies on database errors.
Form::Processor, Form::Processor::Model::CDBI, Data::ObjectDriver
Yann Kerherve, <yann.kerherve at gmail.com>
<yann.kerherve at gmail.com>
Please report any bugs or feature requests to bug-form-processor-model-dod at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Form-Processor-Model-DOD. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-form-processor-model-dod at rt.cpan.org
This module is based on the work of Bill Moseley.
You can find documentation for this module with the perldoc command.
perldoc Form::Processor::Model::DOD
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Form-Processor-Model-DOD
CPAN Ratings
http://cpanratings.perl.org/d/Form-Processor-Model-DOD
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Form-Processor-Model-DOD
Search CPAN
http://search.cpan.org/dist/Form-Processor-Model-DOD
Copyright 2007 Yann Kerherve, 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 Form::Processor::Model::DOD, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Form::Processor::Model::DOD
CPAN shell
perl -MCPAN -e shell install Form::Processor::Model::DOD
For more information on module installation, please visit the detailed CPAN module installation guide.