Application::Firewall - Input Validation as a Middleware
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.