Data::Validator::Item

Description

Data::Validator::Item is a Factory Class to validate data items. This is an attempt to create an object which will permit semi-automatic verification of a data value. SYNOPSIS use Data::Validator::Item; my $item = Data::Validator::Item->new(); #Create a new Data::Validator::Item, called $item. #Set values $item->name(fred); $item->values([1,2,3]); or $item->values(@array); $item->missing(*); or $item->missing(); #undef is unlikely to be sensible! $item->min(0); $item->max(100); $item->verify($reference_to_subroutine); #Used in the $item->validate() function $item->transform($reference_to_subroutine); #Used in the $item->put() function #Get values my $name = $item->name(); my @values = $item->values(); my $missing = $item->missing(); etc... #Use it.. $item->validate(); #Returns 1 for success, 0 for failure $item->error(); #Returns the correct error message $item->put(); USAGE Many people work with data organised as records, each containing (potentially many) variables. It is often necessary to process files of such records, and to test every variable within every record to ensure that each one is valid. I do this before putting data from very large flat files into my databases. For each variable I had a need to define specific, sometimes complex rules for validity, then implement them, and check them. This is what Data::Validator::Item is for. Note carefully that Data::Validator::Item handles only one scalar vlaue at a time. This value could come from a file, a database, an array, a hash or your grannys parrot. Data::Validator::Item doesnt care. I use Data::Validator::Item as follows. I create one for every named variable in my data file. In many real applications most of this setup can be done by looping over a list of variable names, creating many Data::Validator::Items each named for the corresponding variable. Common features, like missing values, and names can be set in this loop. Specifics, like values(), min(), max(), verify() and so on can be set individually. I then create a hash to hold all of the Data::Validator::Items for a particular data source, The keys of this hash are the names of the variables, and the values are the Data:Validators themselves. Y.M.M.V..

Datavalidatoritem - Factory Class - Data - Values - Validate - Variable - Missing - Factory - Libraries - Programming

Published By:Anthony Staines

License Type:Freeware

Date Added:22 October, 2010

Version:0.75

Price:Free

Downloads:558

Size:11.3 KB

Platform: Linux

What people say
- required fields
     
Related Downloads

dtRdr::Config is a Perl module with Factory class for configuration system.

DateAug 19, 2010

AuthorDan Sugalski

Size2.8 MB

LicenseFreeware

PriceFree

PlatformLinux

CategoryLinux Programming

Text::Emoticon is a factory class for Yahoo! and MSN emoticons.

DateSep 4, 2010

AuthorTatsuhiko Miyagawa

Size2.0 KB

LicenseFreeware

PriceFree

PlatformLinux

CategoryLinux Programming

Data::Encrypted is a Perl module to transparently store encrypted data via RSA. SYNOPSIS # functional interface: use Data::Encrypted file => "./.

DateAug 12, 2010

AuthorAaron J Mackey

Size7.2 KB

LicenseFreeware

PriceFree

PlatformLinux

CategoryLinux Programming

Cisco IP Accounting Fetcher is a set of Perl scripts that allows you to fetch IP accounting data from Cisco routers. There is the only one config file - "getdata.conf for configuration..

DateAug 5, 2010

AuthorAnatoly Ivanov

Size12.3 KB

LicenseFreeware

PriceFree

PlatformLinux

CategoryLinux Internet

EDIReader is a Java package for parsing business documents structured according to EDI (Electronic Data Interchange) standards.

DateOct 12, 2010

AuthorBerryWorks

Size675.8 KB

LicenseFreeware

PriceFree

PlatformLinux

CategoryLinux Utilities