Data::Type::Docs - the manual overview
Frequently asked questions.
Frequently occuring problems.
Point to point recipes how to get things done.
Exact API description. Startpoint for datatype developers.
First read the following paragraphs and then you may start study the Data::Type API.
Because the subject is so stuffed with uncommon or not entry level 'keywords', here a short list of what is what.
Sometimes classes have a weird API (of course, because personal taste). Unfortunately the logic behind is highly usefull (thats what CPAN is strong in) and you want invest time to rework everything. Then you can write a cleaner API for that class that just use the original class in it. Or this may be usefull to easily switch the "worker" class behind your newly one (thats a facade then).
Not the strongest point of perl5. But there are some modules on CPAN which try to do the best to emulate exception handling. The one with the nicest syntactic sugar is Error. I derived an inheritable version with Class::Maker::Exception which is readily available within Data::Type.
A candidate value is tested whether it fits within in a certain range of values (the value space). The thing/objects/class/package that represents and implements the logic of the value space is the valuetype.
This is something more abstract. Within this documentation i refer to datatypes, but mostly mean valuetypes. From a practical point of view one could propagate that a datatype excels over a valuetype when it has the ability to be cast()ed from one datatype into another. Some say a datatype should relate to physical boundaries of the computer (like bits, bytes, etc.). In fact the old datatypes were more usefull for a compilers optimizer then for the programmer.
cast()
[Note] Apocalypse 6 (Larry Wall) and Synopsis 6 (Damian Conway, Allison Randal) issue this intensivly.
A value space can contain many facets. Facets are the building blocks of any value space. Matching a regex, beeing not undef, the size of a string can be a facet. Sticking to this concept, you have high level of code reuse and it helps to debug problem during testing a value against a value space. Because many datatypes share a common set of characterstics, facets can be reused. The implementation of the summary() function requires facets (summary()).
undef
summary()
The implemention of summary required use of facets. Even they rediculously easy. For this you should create anonymous facets or private facets. There name should start with '__'. Example:
summary
{ package Data::Type::Object::email; { package Data::Type::Facet::__email; } sub test : method { Data::Type::ok( 1, Data::Type::Facet::__email() ); } }
[Note] I really recommend this.
This is just a cleanser. It reformats or removes insignficant parts of the initial value. Like stripping whitespaces or modifying cases. There are some fundamental within Data::Type::Filer.
Within this distribution a collection is just a namespace. They reside undes Data::Type::Collection::<name>. They group certain datatypes into a homogeneous collection with an unified interface and behaviour. It has also a common prefix for the datatype qualification i.e. Datatypes belonging to the W3C collection begin with W3C::. With use Data::Type ':all +W3C' (note: unimplemented yet) you can load additional collections which arent loaded by default (Only the 'Std' collection is loaded by default).
Data::Type::Collection::<name
W3C
W3C::
use Data::Type ':all +W3C'
Sourceforge http://sf.net/projects/datatype is hosting a project dedicated to this module. And I enjoy receiving your comments/suggestion/reports also via http://rt.cpan.org or http://testers.cpan.org.
Murat Uenalan, <muenalan@cpan.org>
To install Data::Type, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Type
CPAN shell
perl -MCPAN -e shell install Data::Type
For more information on module installation, please visit the detailed CPAN module installation guide.