NAME

Data::Type - robust, extensible data- and valuetype system

VERSION

0.01.15 (Fri Sep 12 17:37:53 2003)

DESCRIPTION

This module delivers an easy, generic and unified interface to type related CPAN modules. They all have one common purpose: reporting if data has some "characteristics". They are good in that, but authors differ significantly in there api. Email::Valid is an illustrous example: reporting if a string has characteristics of an email address. The address() method reports this via returning 'yes' or 'no'. Another module, another behaviour: Business::ISSN tests for the characteristics of an "International Standard Serial Number" and does this via an is_valid() method returning <true> or <false>.

SYNOPSIS

 use Data::Type qw(:all +W3C)  # or +BIO, +DB

 PROCEDURAL

  warn 'invalid email' unless is STD::EMAIL;

  dvalid( $email, STD::EMAIL ) or die $Data::Type::err;                # Exceptions are stored in $Data::Type::err

 OBJECT-ORIENTED

  try
  {
    valid '01001001110110101', STD::BINARY;
  }
  catch Data::Type::Exception with
  {
    my $dte = shift;

    foreach my $dt ( summary( $dte->type ) )
    {
      printf "\texpecting it %s %s ", $dt->[1] ? 'is' : 'is NOT', $dt->[0]->info();
    }
  };

  foreach my $dt ( STD::EMAIL, STD::WORD, STD::CREDITCARD( 'MASTERCARD', 'VISA' ), STD::BIO::DNA, STD::HEX )
  {
    print $dt->$_ for qw(VERSION info usage export param)

    print "belongs to DB collection" if $dt->isa( 'Data::Type::Collection::DB::Interface' ); # is it a Database related type ?
  }


EXAMPLES

Visit the 't' directory.

INSTALLATION

To install this module type the following:


I highly recommend to use CPAN for one-stop-shop installation:

perl -MCPAN -e "install Data::Type"


TYPES and FILTERS

perl -e "use Data::Type qw(:all); print catalog()" lists all supported types:




PREREQUISITES

Following modules get automatically installed via the CPAN module. See INSTALLATION above. Data::Type has a mechanism
for delayed loading of modules. This means modules are loaded only when the used types require
them, not all at once.


    Class::Maker 0.05.17

    Error 0.15

    IO::Extended 0.05

    Tie::ListKeyedHash 0.41

    Data::Iter 0

    Class::Multimethods 1.70

    Attribute::Abstract 0.01

    DBI 1.30

    Text::TabularDisplay 1.18

    String::ExpandEscapes 0.01

    Locale::Language 2.02

    Business::CreditCard 0.27

    Email::Valid 0.14

    Business::UPC 0.04

    HTML::Lint 1.23

    Business::CINS 1.13

    Date::Parse 2.27

    Business::ISSN 0.90

    Net::IPv6Addr 0.2

    Regexp::Common 2.113

    X500::DN 0.28

    Locale::SubCountry 0

    XML::Parser 2.31

    XML::Schema 0.07

    Pod::Find 0.23


AUTHOR

Murat Uenalan, <muenalan@cpan.org>

COPYRIGHT/LICENSE


(c) 2002 by Murat Uenalan. All rights reserved. Note: This program is
free software; you can redistribute it and/or modify it under the same
terms as perl itself