Valiant::Result::Object - Wrap any object into a validatable result object.




Create a validation object for a given class or role. Useful when you need (or prefer) to build up a validation ruleset in code rather than via the annotations-like approach given in Valiant::Validations. Can also be useful to add validations to a class that isn't Moo/se and can't use Valiant::Validations or is outside your control (such as a third party library). Lastly you may need to build validation sets based on existing metadata, such as via database introspection or from a file containing validation instructions.

This uses AUTOLOAD to delegate method calls to the underlying object.

Please note that the code used to create the validation object is not speed optimized so I recommend you not use this approach in 'hot' code paths. Its probably best if you can create all these during your application startup once (for long lived applications). Maybe not ideal for 'fire and forget' scripts like cron jobs or CGI.

You probably won't use this directly (although you can) since we have Valiant::Class to encapsulate the most common patterns for this need.


This does the interface defined by Valiant::Result so see the docs on that.

Also: Valiant, Valiant::Validator, Valiant::Validator::Each.