Data-Type
view release on metacpan or search on metacpan
LOCALE
- Types suffix the l18n language code: TYPE::DE for "de" (german).
[Note] You would need an implicit Data::Type::L18N::de package.
Only C<type export> names with a correspondent ::L18N::xx package should
be allowed. This may not make sense when no localization is needed,
but it will prevent consufion.
- Data::Type::l18n_list() returns the implemented localized packages
FACETS
- move C<Data::Type::Facet::Proxy> to C<Data::Type::Facet>
- now every Facet isa C<Data::Type::IFacet> (empty)
API
- renamed C<verify> to C<valid>
- Data::Type::Facet::match has new usage
- Data::Type->filter now wants list of [ 'filtername', @args ]
- Data::Type::Object::*->test and Data::Type::Filter::*->test now doesnt take any args. Instead Data::Type::value is
consequently used.
- added C<isnt> as an alias for C<no is( TYPE )>
todo
{
Eliminate tricks flagged with "dirty"
}
todo(BUG)
{
->test of datatypes requires invocation of facets via Data::Type::ok for correct summary generation.
THIS MEANS: ALL ->test() DATATYPE METHODS MUST BE CLEANED FROM DIRECT C<throw Exception>. POSSIBLE
SOLUTION: EVERYTHING STUFFED IN FACETS:
OR ANY IDEA ?
}
comment
{
For now use of "private facets" is recommended.
}
todo(PRIO => 10)
{
lib/Data/Type/Facet.pm view on Meta::CPAN
}
sub test : method
{
my $this = shift;
Data::Type::Facet::defined->test;
if( $Data::Type::DEBUG )
{
warn sprintf "FACET match %s value '%s' with $this->[0] (regexp '%s')",
defined( $Data::Type::value ) ? 'defined' : 'undefined',
$Data::Type::value,
$Data::Type::rebox->request( $this->[0], 'regexp', @$this );
}
unless( $Data::Type::value =~ $Data::Type::rebox->request( $this->[0], 'regexp', @$this ) )
{
lib/Data/Type/Facet.pm view on Meta::CPAN
}
=head1 DESCRIPTION
Facets are bric's for L<Data::Type::Object>'s. They are partially almost trivial (more or less), but have some advantages. They are modularising the testing procedure of any datatype (and therefore giving the magic to the L<Data::Type/summary()> func...
=head1 EXCEPTIONS
L<Data::Type::Facet::Exception> is thrown by any facet to indicate L<Data::Type> that it failed to pass.
=head1 FACETS
=head2 Data::Type::Facet::ref( I<type> )
Data::Type::Facet::ref();
Data::Type::Facet::ref( 'ARRAY' ); # 'HASH' | 'CODE' | ..
Whether the value is a reference. If I<type> is given, this explicit reference is required. So if C<$Data::Type::value = [ 1, 2 ]> then
ok( 1, Data::Type::Facet::ref( 'ARRAY' ) );
#$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 ??????";
( run in 1.357 second using v1.01-cache-2.11-cpan-39bf76dae61 )