NAME
Gantry::Utils::Validate - Validates input values.
SYNOPSIS
$chk = Gantry::Utils::Validate->new();
if ( $chk->is_date( $date ) )
if ( $chk->is_email( $email ) )
if ( $chk->is_float( $float ) )
if ( $chk->is_ident( $ident ) )
if ( $chk->is_integer( $integer ) )
if ( $chk->is_ip( $ip ) )
if ( $chk->is_mac( $mac ) )
if ( $chk->is_number( $number ) )
if ( $chk->is_text( $text ) )
if ( $chk->is_time( $time ) )
DESCRIPTION
This module allows the validation of many common types of input.
METHODS
- new
-
Standard constructor, call it first. It takes nothing.
- is_date( $date )
-
This function takes a date,
$date, and verifies that it is indeed a valid date. The date must be of the form "MM-DD-YYYY". The function returns either '1' or '0'. - is_email( $email )
-
This function checks to see if
$emailis a valid email address. It checks only the form of the email address and not if the username or the domain exist. The function returns either '1' or '0'. - is_float( $float )
-
This function checks to see if
$floatis a valid floating point number. The function returns either '1' or '0'. - is_ident( $ident )
-
This function checks to see if
$identis a valid text ident. This means it has text, and none of the text is a space. The function returns either '1' or '0'. - is_integer( $integer )
-
This function checks to see if
$integeris in fact a valid integer number. The function returns either '1' or '0'. - is_ip( $ip )
-
This function checks to see if
$ipis a valid ip address. The function returns either '1' or '0'. - is_mac( $mac )
-
This function checks to see if
$maccontains the valid characters for a MAC address. It does not currently check to see if the MAC address is of the proper length. The function returns either '1' or '0'. - is_number( $number )
-
This function checks to see if
$numberis a valid number. It does this by checking if it passesis_integer()oris_float(). The function returns eiter a '1' or a '0'. - is_text( $text )
-
This function checks to see if
$textdoes contain text. This is a fairly broad range of things mainly it must be defined and have a length that is greater than 0. The function returns either a '1' or a '0'. - is_time( $time )
-
This function checks to see if
$timedoes contain a valid time. A valid date is in military time ( 0-23:0-59 ) seconds are optional.
SEE ALSO
Gantry(3), Date::Calc(3)
LIMITATIONS
This module depends on Date::Calc(3) for the is_date validation.
AUTHOR
Tim Keefer <tkeefer@gmail.com>
Nicholas Studt <nstudt@angrydwarf.org>
COPYRIGHT and LICENSE
Copyright (c) 2005-6, Tim Keefer.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.