[sf-perl] Favorite form validation modules?
Bill Moseley
moseley at hank.org
Wed Jan 6 14:38:35 PST 2010
I wrote and use Form::Processor.
I have used a number of modules for validation. Most were about specifying
forms via a config file and rendering HTML markup. I really like
Rose::HTML::Objects, but found myself customizing it to the point where I
realized I should just start from scratch.
I was less interested in rendering mark up. That's pretty easy anyway, and
I also need custom markup more often than not so the automatic rendering
never quite worked for me.
I was more interested in the other side -- where the data comes and goes
from the store (mostly database). So, Form::Processor can work with ORMs,
for example, to automatically populate lookup lists and update many-to-many
relationships.
I also need more than config-based validation parameters. In
Form::Processor fields and forms are classes. So adding new custom fields
is easy, and forms can contain methods to do much more complex things than
can be done with config-based forms. And, of course, forms can inherit from
other forms as can fields.
I was also interested in removing much of the code I felt I was repeating
often in controllers. For an example see:
http://search.cpan.org/~hank/Catalyst-Plugin-Form-Processor-0.06/lib/Catalyst/Plugin/Form/Processor.pm
There's two or three "model" classes for Form::Processor -- they basically
interface with a specific ORM. I used Class::DBI quite a bit so that's the
one I wrote. Gerda Shank wrote one for DBIx::Class. I'm using a customized
verion of the DBIx::Class one now -- the one Gerda wrote tries to cover more
situations but as a result has some bugs.
Gerda also attempted to rewrite Form::Processor using Moose instead of
Rose::Object. I could never get it to pass my test suite and didn' t have
time to work on it. So, Gerda released HTML::FormHandler which is based on
Form::Processor. I've been meaning to try it with a project some day soon.
I'd recommend trying it.
--
Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20100106/530c7ae9/attachment.html>
More information about the SanFrancisco-pm
mailing list