Data-Type
view release on metacpan or search on metacpan
return;
};
$Error::Debug = 0;
}
$Data::Type::debug = 0;
Data::Type::println "=" x 100;
foreach my $type ( STD::URI, STD::EMAIL, STD::IP( 'V4' ), DB::VARCHAR(80), STD::YESNO, STD::DOMAIN )
{
Data::Type::println "\n" x 2, "Describing ", $type->info;
foreach my $entry ( Data::Type::summary( '', $type ) )
{
Data::Type::printfln "\texpecting it %s %s ", $entry->expected ? 'is' : 'is NOT', Data::Type::strlimit( $entry->object->info() );
}
}
Data::Type::println "Now summary for DOMAIN given C<www.test.com>";
foreach my $entry ( Data::Type::summary( 'www.test.com', STD::DOMAIN ) )
{
Data::Type::printfln "\texpecting it %s %s ", $entry->expected ? 'is' : 'is NOT', Data::Type::strlimit( $entry->object->info() );
}
print "\n", STD::CREDITCARD()->usage, "\n";
print "\n", STD::YESNO::DE()->info, "\n";
print join( "\n", STD::ZIP()->info, STD::ZIP()->usage, STD::ZIP()->doc ), "\n";
# Test whether pkgname is sufficient for summary()
Data::Type::println "Now summary via pkg for Data::Type::Object::bio_codon";
my $type = 'Data::Type::Object::bio_codon';
Data::Type::println "\n" x 2, "Describing ", $type->info;
foreach my $entry ( Data::Type::summary( '', $type ) )
{
Data::Type::printfln "\texpecting it %s %s ", $entry->expected ? 'is' : 'is NOT', Data::Type::strlimit( $entry->object->info() );
}
Data::Type::println "TESTING TYPS";
#$Data::Type::debug = 1;
dvalid "bbbbbbb", BIO::DNA or warn "no dna";
print Data::Dumper->Dump( [ \@Data::Type::err ] );
dvalid "ACTTTTT", BIO::DNA and warn "dna detected";
$_ = "XXXKKKKLLLL";
warn "ALIENS DETECETD" unless is BIO::DNA;
is BIO::DNA or warn "not DNA";
# Thanks to sudoer(at)users.sf.net for this test
try
{
valid('mike_web.oakley.com', STD::EMAIL);
warn "Problem make_web.oakley.com is valid ??????";
}
catch Error with
{
warn "correct warning about make_web.oakley.com";
print STDERR Data::Dumper->Dump( [ \@_ ] );
};
package Bob;
Data::Type::try { Data::Type::valid('mike_web.oakley.com', STD::EMAIL ) } catch Error Data::Type::with { print STDERR Data::Dumper->Dump( [ \@_ ] ) };
__END__
( run in 0.823 second using v1.01-cache-2.11-cpan-39bf76dae61 )