in reply to Preferred Way of Scrubbing User Input Before DB Write

jk2addict,

Well, why not give us a short one to answer on Monday, hard ones are supposed to be for Friday aren't they?

It really depends on what you expect. Using HTML::Sanitize is handy when you have a form on a web site. I don't use it a lot because my validator tends to handle most of the stuff.

The heavy artillery in this battle is Data::FormValidator which comes with Data::FromValidator::Constraints and all of which can be teamed up with Regexp::Common. Validator has a series of filters already included, and you can add others, so you can write a validator/filter combaination for your descriptions that allows plain text with no HTML. But where it is somebodies sig file you might want to allow limited HTML styling.

Apart from the contraints and rules already created you can add your own using several different methods and even create complex rules that involve multiple fields or complex relationships. The ability to use cpan;//Regexp::Common is pretty darned amazing, but it is something I have never had need of yet, well, not yet! Maybe in a day or two looking at my to do list :)

jdtoronto

  • Comment on Re: Preferred Way of Scrubbing User Input Before DB Write