Over the weekend, after writing this article, I decided to improve Validation::Class (my input validation framework).
I started by using Moose (very important, almost expected these days), and removing the cruft. I rewrote the documentation for speedy comprehension and made the code more modular. I cleaned-up the code, fixed the known bugs and added a few new features.
Overall the syntax is still the same but the experience has many improvements.
My recent exposure to Node.js (the non-blocking server-side JavaScript Event framework) (which because of its nature uses all plugins as middlewares), got me thinking about approaching the issue of input validation as a middleware in my own non-Node.js applications.
Most modern web application frameworks allow its developers to specify hooks that execute specific functionality before a route is executed and rendered. This is an ideal place to insert site-wide input validation rules. Many snazzy input validation frameworks or libraries allow its users to design input validation profiles which promotes code reuse which is good.
I myself have developed an input validation framework for Perl (Validation::Class) which I use in a few active perl web applications. As stated in the documentation:
Validation::Class is a different approach to data validation, it attempts to simplify and centralize data validation rules to ensure DRY (don’t repeat yourself) code. The primary intent of this module is to provide a simplistic validation work-flow and promote code (validation) reuse.
… read more here