The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Valiant::Validator::Collection - A validator that contains and runs other validators

SYNOPSIS

    NA

DESCRIPTION

This is used internally by Valiant and I can't imagine a good use for it elsewhere so the documentation here is light. There's no reason to NOT use it if for some reason a good use comes to mind (I don't plan to change this so you can consider it public API but just perhaps tricky bits for very advanced use cases).

I guess it could be used to make very complicated nested validations. I'm not going to show you how to do that since I think only people that can figure it out should be allowed. If you think I'm wrong ping me on IRC and submit a doc patch.

ATTRIBUTES

This validator role provides the following attributes

if / unless

Accepts a coderef or the name of a method which executes and is expected to return true or false. If false we skip the validation (or true for unless). Recieves the object, the attribute name and the value to be checked as arguments.

message

Provide a global error message override for the constraint. Will accept either a string message or a translation tag. Please not that many validators also provide error type specific messages for providing custom errors (as well as the ability to setup your own errors in a localization file. Using this attribute is the easiest but probably not always your best option.

strict

When true instead of adding a message to the errors list, will throw exception with the error instead. If the true value is the name of a class that provides a throw message, will use that instead.

on

A scalar or list of contexts that can be used to control the situation ('context') under which the validation is executed.

METHODS

This role provides the following methods. You may wish to review the source code of the prebuild validators for examples of usage.

options

Used to properly construct a options hashref that you should pass to any calls to add an error. You need this for passing special values to the translation method or for setting overrides such as strict or message.

SEE ALSO

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

AUTHOR

See Valiant

COPYRIGHT & LICENSE

See Valiant