You can always use Perl taint to be your overly paranoid variable checker. Now a days not a lot of people use taint or even remember what it does, but it is definitely going to show you what is possibly tainted data. It is also a very good tool to learn where tainted data can come from.
Then all you need to do is learn regular expressions to filter or detect the issue.
With most variable validating modules you will still have to know what you want to filter and what the data format is.