The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Brannigan::Validations - Built-in validation methods for Brannigan.

VERSION

version 0.2

DESCRIPTION

This module contains all built-in validation methods provided natively by the Brannigan input validation/parsing system.

METHODS

All these methods receive the value of a parameter, and other values that explicilty define the requirements. They return a true value if the parameter's value passed the test, or a false value otherwise.

required( $value, $boolean )

If $boolean is true, makes sure a required parameter was indeed provided, otherwise simply returns true.

Please note that if a parameter is not required and indeed isn't provided with the input parameters, any other validation methods defined on the parameter will not be checked.

forbidden( $value, $boolean )

If $boolean is true, makes sure a forbidden parameter was indeed NOT provided. Otherwise, a true value is returned.

length_between( $value, $min_length, $max_length )

Makes sure the value's length (stringwise) is inside the range of $min_length-$max_length.

min_length( $value, $min_length )

Makes sure the value's length (stringwise) is at least $min_length.

max_length( $value, $max_length )

Makes sure the value's length (stringwise) is no more than $max_length.

exact_length( $value, $length )

Makes sure the value's length (stringwise) is exactly $length.

integer( $value, $boolean )

If boolean is true, makes sure the value is an integer.

value_between( $value, $min_value, $max_value )

Makes sure the value is between $min_value and $max_value.

min_value( $value, $min_value )

Makes sure the value is at least $min_value.

max_value( $value, $max )

Makes sure the value is no more than $max_value.

datetime( $value )

Makes sure that value is a properly formatted date/time string. For accepted formats, check out DateTime::Format::ISO8601.

SEE ALSO

Brannigan, Brannigan::Tree.

AUTHOR

Ido Perlmuter, <ido at ido50.net>

BUGS

Please report any bugs or feature requests to bug-brannigan at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Brannigan. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

        perldoc Brannigan::Validations

You can also look for information at:

ACKNOWLEDGEMENTS

Brannigan is inspired by Oogly (Al Newkirk) and the "Ketchup" jQuery validation plugin (http://demos.usejquery.com/ketchup-plugin/).

LICENSE AND COPYRIGHT

Copyright 2010 Ido Perlmuter.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.