NAME
Apache::Wyrd::Datum - Abstract data-checking objects for Wyrd Input objects
SYNOPSIS
use Apache::Wyrd::Datum;
my $ives = Apache::Wyrd::Datum::Set->new(
  'kits',
  {
    options => ['kits', 'cats', 'sacks', 'wives'],
    not_null => 0
  }
);
my ($are_ostriches_ok, $why_not) = $ives->check('ostriches')
my $is_cats = $ives->set('cats');
if ($is_cats) {
  print "yes, it can be cats"
} else {
  print "no, cats are out"
}
my $suggest_something_then = $ives->suggest;
OBJECTS
This module defines the following objects:
- Apache::Wyrd::Datum
 - Apache::Wyrd::Datum::Char
 - Apache::Wyrd::Datum::Varchar
 - Apache::Wyrd::Datum::Text
 - Apache::Wyrd::Datum::Set
 - Apache::Wyrd::Datum::Enum
 
DESCRIPTION
These objects are roughly tied to SQL data types and HTML inputs for providing data objects to higher-level objects. By abstracting the data class, the definintion of a "valid" value can be abstracted from the SQL or Wyrd device it will be used to check the values of.
These are used by Apache::Wyrd::Input-derived classes to check user-input.
METHODS
All Classes have the following methods:
- new
 - 
my $data = Apache::Wyrd::Datum->new($value, \%params); - set
 - 
$data->set('value') #sets data to value (if strict, will return undef and fail to set) - get
 - 
my $value = $data->get('value'); #Return value (always a scalar) - check
 - 
$data->check('somevalue') #returns undef on invalid data. #Second returned param is an #[optional] error message. - type
 - 
$data->type #returns Data type: Char, Varchar, etc. in lower case - suggest
 - 
$data->suggest #returns a suggested value [if implemented]. 
DEVELOPMENT
Derived classes of Apache::Wyrd::Datum should override:
_type
_check_params
_check_value
And will probably want to override:
_default_value
_raise_exception
PARAMS
All Datum objects are initialized with
- Char
 - 
params: strict, length, not-null
 - Varchar
 - 
params: strict, length, not-null
 - Text
 - 
params: strict, not-null
 - Blob
 - 
params: strict, not-null
 - Set
 - 
params: strict, not-null, options (arrayref of possible options)
 - Enum
 - 
params: strict, not-null, options (arrayref of possible options)
 
AUTHOR
Barry King <wyrd@nospam.wyrdwright.com>
LICENSE
Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for Apache::Wyrd.
3 POD Errors
The following errors were encountered while parsing the POD:
- Around line 402:
 You forgot a '=back' before '=head1'
- Around line 440:
 '=item' outside of any '=over'
- Around line 464:
 You forgot a '=back' before '=head1'