John Karr > String-Validator-Common-0.97 > String::Validator::Common

Download:
String-Validator-Common-0.97.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.97   Source   Latest Release: String-Validator-Common-1.01

NAME ^

String::Validator::Common - Routines shared by String::Validator Modules.

VERSION ^

Version 0.97

SYNOPSIS ^

There are some methods common to all String::Validator Modules. By starting with this module other String::Validator Modules inherit these methods.

String::Validator::Common Methods and Usage ^

Modules Using String Validator Common use its' new method and then extend the attributes in their own new methods.

 use String::Validator::Common;
 sub new {
 my $class = shift ;
 my $self = { @_ } ;
 use base ( 'String::Validator::Common' ) ;
 unless ( defined $self->{ some_param } )
   { $self->{ some_param } = 'somedefault'; }
 ...
 bless $self , $class ;
 return $self ;
 }

Methods String::Validator::Common provides ^

IncreaseErr

A String::Validator contains two error variables error and errstring. When an error is found, simply pass a brief description to this method to increment the errorcount, and append the present description to the errstring.

 if ( 1 != 2 ) { $self->IncreaseErr( qq /1 Still Doesn't equal 2!/ ) }

Start

This method initializes three key values: $self->{errstring} , $self->{error}, and $self->{string} to NULL, 0, NULL. If no errors are found error and errstring will remain 0 and NULL. string will be used to hold the string being evaluated. Arguments are the string to be evaluated and optionally a second string to be compared with the first. If the strings are mismatched the sub will return 99, and string will remain NULL, the inheriting module should immediately return the error and not contine.

Length

Checks $self->{ string } against $self->{ min_length } and $self->{ max_length } If the length checks pass it returns 0, if one fails it immediately returns the incremented value of error.

CheckCommon

CheckCommon is just a shortcut to run Start and Length.

Check

A stub for testing, overridden in actual string validator classes.

Errstr, Errcnt, String

Provides these methods for inheritance as described in the String::Validator documentation.

AUTHOR ^

John Karr, <brainbuz at brainbuz.org>

BUGS ^

Please report any bugs or feature requests to bug-string-validator-email at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=String-Validator-Email. 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 String::Validator::Email

You can also look for information at:

ACKNOWLEDGEMENTS ^

LICENSE AND COPYRIGHT ^

Copyright 2012 John Karr.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 3 or at your option any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

A copy of the GNU General Public License is available in the source tree; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

syntax highlighting: