naturalist/Validate--Tiny — pull request #4 by bannaN (2012-09-05 11:32:46+00:00)
Title: Functionality request

Hi,

First of all, let me say thank you for a great module. I have been looking over a lot of validating modules on CPAN and decided to use Validate::Tiny for my current project, and i so far very pleased with my choice.

As probably many of the users using Validate::Tiny i need to define more validation method that those who are packaged within the package. And in doing so a come over a need for passing extra arguments to such validation methods.
My case exactly is that i need to localize our software for several languages and because different languages has different ways of building the sentence depending on the content i need the error message to be generated within these validation subs. (For the long version of this story, you can see this article http://search.cpan.org/~toddr/Locale-Maketext-1.22/lib/Locale/Maketext/TPJ13.pod ).

So, since Validate::Tiny has the convention that the the returned value for such an validation subroutine is used as the error message (This is also the only place i have the validation value available, and i know exactly why it doesn't validate ) i need this subroutine to return the text in the correct language. To achieve this i need in my case an localization object to be passed to the validation subroutines.

Since i need this functionality it might be others that need it also, so i have created a patch that implements the functionality.
Please let me know what you think. If you think this functionality is useful, but wants it implemented in a different way, let me know, and i will try to edit my code to follow your suggestions.

Best regards
Joakim