Welcome, Data::FormValidator::Constraints::MethodFactory

markjugg on 2007-08-04T14:24:49

A new module has been released for Data::FormValidator, Data::FormValidator::Constraints::MethodsFactory

For a quick overview, when I inherited maintenance of Data::FormValidator, it came with a ConstraintsFactory module. It has always seemed unwieldy, and I have hardly ever used and it mostly ignored it, despite being the current official maintainer of it.

For example, to express that you would like one constraint or another to be used, you would use:

make_or_constraint( $c1, $c2)

Where $c1 and $c2 are constraints.

Graham TerMarsch upgraded this whole system in two important ways with his module release. First, all of these factory methods are now "constraint methods", meaning that the constraint now has access to the Data::FormValidator object, allowing much greater flexibility.

Second, he fixed the unwieldy names that bothered me so much. So the above example would be expressed more directly as:

FV_or( $c1, $c2)

If you mean "or", you should just able to say "or"!. It's sort of a wart that it includes the "FV_" prefix, but that's consistent with other parts of DFV, so I think that's for the best.

Enjoy this new form validation tool!

Mark