Data::Type 0.01.04
Sponsored Links
Data::Type 0.01.04 Ranking & Summary
File size:
0.022 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
1117
Date added:
2006-10-02
Publisher:
Murat Ünalan
Data::Type 0.01.04 description
Data::Type is a Perl module with versatile data and value types.
SYNOPSIS
use Data::Type qw(:all);
use Error qw(:try);
try
{
verify $email , EMAIL;
verify $homepage , URI(http);
verify $cc , CREDITCARD( MASTERCARD, VISA );
verify $answer_a , YESNO;
verify $gender , GENDER;
verify one , ENUM( qw(one two three) );
verify [qw(two six)], SET( qw(one two three four five six) ) );
verify $server_ip4 , IP(v4);
verify $server_ip6 , IP(v6);
verify A35231AH1 , CINS;
verify 14565935 , ISSN;
verify DE , LANGCODE;
verify German , LANGNAME;
verify 012345678905, UPC();
verify 5276440065421319, CREDITCARD( MASTERCARD ) );
verify ATGCAAAT , BIO::DNA;
verify AUGGGAAAU , BIO::RNA;
verify 01001001110110101, BINARY;
verify 0F 0C 0A, HEX;
verify 0 , DEFINED;
verify 234 , NUM( 20 );
verify 1 , BOOL( true );
verify 100 , INT;
verify 1.1 , REAL;
my $foo = bless( 123, SomeThing );
verify $foo , REF;
verify $foo , REF( qw(SomeThing Else) );
verify [ bar ] , REF( ARRAY );
verify x 20 , VARCHAR( 20 );
verify 2001-01-01 , DATE( MYSQL );
verify 16 Nov 94 22:28:20 PST , DATE( DATEPARSE );
verify 9999-12-31 23:59:59, DATETIME;
verify 1970-01-01 00:00:00, TIMESTAMP;
verify -838:59:59 , TIME;
verify 2155 , YEAR;
verify 69 , YEAR(2);
verify 0 x 20 , TINYTEXT;
verify 0 x 20 , MEDIUMTEXT;
verify 0 x 20 , LONGTEXT;
verify 0 x 20 , TEXT;
verify 80 , PORT;
verify www.cpan.org, DOMAIN;
}
catch Type::Exception with
{
my $e = shift;
printf "Expected %s %s at %s line %sn",
$e->value,
$e->type->info,
$e->was_file,
$e->was_line;
foreach my $entry ( testplan( $e->type ) )
{
printf "texpecting it %s %s ", $entry->[1] ? is : is NOT, $entry->[0]->info();
}
};
# believe it or not, this really works
foreach ( EMAIL, WORD, CREDITCARD( MASTERCARD, VISA ), BIO::DNA, HEX )
{
print $_->info;
print $_->usage;
print $_->export; # does it have other names
print $_->param; # what are my choice i.e. [yes,no]
print $_->isa( IType::Business ); # is it a Business related type ?
print $_->VERSION; # first apperance in Data::Type release
}
# tied interface (alias typ)
try
{
typ ENUM( qw(DNA RNA) ), ( my $a, my $b );
print "a is typed" if istyp( $a );
$a = DNA; # $alias only accepts DNA or RNA
$a = RNA;
$a = xNA; # throws exception
untyp( $alias );
}
catch Type::Exception ::with
{
printf "Expected %s %s at %s line %sn",
$e->value,
$e->type->info,
$e->was_file,
$e->was_line;
};
dverify( $email, EMAIL ) or die $!;
my $g = Data::Type::Guard->new(
allow => [ Human, Others ], # blessed objects of that type
tests =>
{
email => EMAIL( 1 ), # mxcheck ON ! see Email::Valid
firstname => WORD,
social_id => [ NUM, VARCHAR( 10 ) ],
contacts => sub { my %args = @_; exists $args{lucy} },
}
);
$g->inspect( $h );
# compact version
overify { email => EMAIL( 1 ), firstname => WORD }, $object_a, $object_b;
print toc();
print catalog();
This module supports versatile data and value types. Out of the ordinary it supports parameterised types (like databases have i.e. VARCHAR(80) ). When you try to feed a typed variable against some odd data, this module explains what he would have expected.
SYNOPSIS
use Data::Type qw(:all);
use Error qw(:try);
try
{
verify $email , EMAIL;
verify $homepage , URI(http);
verify $cc , CREDITCARD( MASTERCARD, VISA );
verify $answer_a , YESNO;
verify $gender , GENDER;
verify one , ENUM( qw(one two three) );
verify [qw(two six)], SET( qw(one two three four five six) ) );
verify $server_ip4 , IP(v4);
verify $server_ip6 , IP(v6);
verify A35231AH1 , CINS;
verify 14565935 , ISSN;
verify DE , LANGCODE;
verify German , LANGNAME;
verify 012345678905, UPC();
verify 5276440065421319, CREDITCARD( MASTERCARD ) );
verify ATGCAAAT , BIO::DNA;
verify AUGGGAAAU , BIO::RNA;
verify 01001001110110101, BINARY;
verify 0F 0C 0A, HEX;
verify 0 , DEFINED;
verify 234 , NUM( 20 );
verify 1 , BOOL( true );
verify 100 , INT;
verify 1.1 , REAL;
my $foo = bless( 123, SomeThing );
verify $foo , REF;
verify $foo , REF( qw(SomeThing Else) );
verify [ bar ] , REF( ARRAY );
verify x 20 , VARCHAR( 20 );
verify 2001-01-01 , DATE( MYSQL );
verify 16 Nov 94 22:28:20 PST , DATE( DATEPARSE );
verify 9999-12-31 23:59:59, DATETIME;
verify 1970-01-01 00:00:00, TIMESTAMP;
verify -838:59:59 , TIME;
verify 2155 , YEAR;
verify 69 , YEAR(2);
verify 0 x 20 , TINYTEXT;
verify 0 x 20 , MEDIUMTEXT;
verify 0 x 20 , LONGTEXT;
verify 0 x 20 , TEXT;
verify 80 , PORT;
verify www.cpan.org, DOMAIN;
}
catch Type::Exception with
{
my $e = shift;
printf "Expected %s %s at %s line %sn",
$e->value,
$e->type->info,
$e->was_file,
$e->was_line;
foreach my $entry ( testplan( $e->type ) )
{
printf "texpecting it %s %s ", $entry->[1] ? is : is NOT, $entry->[0]->info();
}
};
# believe it or not, this really works
foreach ( EMAIL, WORD, CREDITCARD( MASTERCARD, VISA ), BIO::DNA, HEX )
{
print $_->info;
print $_->usage;
print $_->export; # does it have other names
print $_->param; # what are my choice i.e. [yes,no]
print $_->isa( IType::Business ); # is it a Business related type ?
print $_->VERSION; # first apperance in Data::Type release
}
# tied interface (alias typ)
try
{
typ ENUM( qw(DNA RNA) ), ( my $a, my $b );
print "a is typed" if istyp( $a );
$a = DNA; # $alias only accepts DNA or RNA
$a = RNA;
$a = xNA; # throws exception
untyp( $alias );
}
catch Type::Exception ::with
{
printf "Expected %s %s at %s line %sn",
$e->value,
$e->type->info,
$e->was_file,
$e->was_line;
};
dverify( $email, EMAIL ) or die $!;
my $g = Data::Type::Guard->new(
allow => [ Human, Others ], # blessed objects of that type
tests =>
{
email => EMAIL( 1 ), # mxcheck ON ! see Email::Valid
firstname => WORD,
social_id => [ NUM, VARCHAR( 10 ) ],
contacts => sub { my %args = @_; exists $args{lucy} },
}
);
$g->inspect( $h );
# compact version
overify { email => EMAIL( 1 ), firstname => WORD }, $object_a, $object_b;
print toc();
print catalog();
This module supports versatile data and value types. Out of the ordinary it supports parameterised types (like databases have i.e. VARCHAR(80) ). When you try to feed a typed variable against some odd data, this module explains what he would have expected.
Data::Type 0.01.04 Screenshot
Data::Type 0.01.04 Keywords
DNA
EMAIL
Type 0.01.04
RNA
VARCHAR
WORD
Value types
Perl module
0 X
verify
print
E-
s
QW
value
Data::Type
Bookmark Data::Type 0.01.04
Data::Type 0.01.04 Copyright
WareSeeker periodically updates pricing and software information of Data::Type 0.01.04 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Data::Type 0.01.04 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
Data::Type::Docs is a Perl module with the manual overview. Free Download
Data::Generate allows you to create various types of synthetic data by parsing "regex-like" data creation rules. Free Download
TFTP is a TFTP Client class. Free Download
Class::Meta::Type is a Perl module for data type validation and accessor building. Free Download
Data::Diver is a simple, ad-hoc access to elements of deeply nested structures. Free Download
Object::Relation::Meta::Type is an Object::Relation Data type validation and accessor building. Free Download
Test::Data is a Perl module to test functions for particular variable types. Free Download
CGI::Test is a CGI regression test framework. Free Download
Latest Software
Popular Software
Favourite Software