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 {


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).

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).



(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>


Please report any bugs or feature requests to bug-form-processor-model-dod at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


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:


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.