
Data::Domain::SemanticAdapter - Adapter for Data::Semantic objects

Data::Domain::SemanticAdapter->new;

This class is an adapter (wrapper) that turns Data::Semantic objects into Data::Domain objects.
It, and therefore all the subclasses, support a -not_in options. If given, the data must be different from all values in the exclusion set, supplied as an arrayref.
Data::Domain::SemanticAdapter inherits from Data::Domain, Data::Inherited, and Class::Accessor::Complex.
The superclass Data::Domain defines these methods and functions:
Date(), Enum(), Int(), List(), Num(), One_of(), String(), Struct(),
Time(), Whatever(), _check_range(), _parse_args(), import(), inspect(),
messages(), msg(), node_from_path(), subclass()
The superclass Data::Inherited defines these methods and functions:
every_hash(), every_list(), flush_every_cache_by_key()
The superclass Class::Accessor::Complex defines these methods and functions:
cluck(), flatten(), mk_abstract_accessors(), mk_array_accessors(),
mk_boolean_accessors(), mk_class_array_accessors(),
mk_class_hash_accessors(), mk_class_scalar_accessors(),
mk_concat_accessors(), mk_forward_accessors(), mk_hash_accessors(),
mk_integer_accessors(), mk_new(), mk_object_accessors(),
mk_scalar_accessors(), mk_set_accessors(), mk_singleton()
The superclass Class::Accessor defines these methods and functions:
_carp(), _croak(), _mk_accessors(), accessor_name_for(),
best_practice_accessor_name_for(), best_practice_mutator_name_for(),
follow_best_practice(), get(), make_accessor(), make_ro_accessor(),
make_wo_accessor(), mk_accessors(), mk_ro_accessors(),
mk_wo_accessors(), mutator_name_for(), set()
The superclass Class::Accessor::Installer defines these methods and functions:
install_accessor(), subname()

my $value = $obj->adaptee;
$obj->adaptee($value);
A basic getter/setter method. If called without an argument, it returns the value. If called with a single argument, it sets the value.
$obj->adaptee_clear;
Clears the value.
$obj->clear_adaptee;
Clears the value.
Returns the corresponding semantic class name. This method provides a default mapping, the idea of which is to mirror the layout of the Data::Semantic class tree. If you have a different mapping, override this method in a subclass.
So in the Data::Domain::URI::http class, it will return Data::Semantic::URI::http.
Takes the results of semantic_class_name() and semantic_args(), loads the semantic data class and returns a semantic data object with the given args passed to its constructor.
Turns the object's options, specified via OPTIONS(), into arguments to be passed to the semantic data object's constructor. Returns a hash.
Inspects the data using the adaptee(). See Data::Domain for more information. Respects the -not_in option and returns a EXCLUSION_SET message, if appropriate. If the adaptee() says that the data is not valid under the given options, an INVALID message is returned.
This is a convenience function (not method) that installs shortcuts into the calling package. It expects a mapping hash whose keys are the shortcuts to be created and whose values are the package names relative to Data::Domain::. See Data::Domain, section Shortcut functions for domain constructors, for more information on shortcuts.
Here is an example from Data::Domain::Net:
our %map = (
IPv4 => 'Net::IPAddress::IPv4',
IPv6 => 'Net::IPAddress::IPv6',
);
Data::Domain::SemanticAdapter::install_shortcuts(%map);
This installs two functions, IPv4() and IPv6(), into Data::Domain::Net. Now code that wants to use network-based domain objects can just say:
use Data::Domain::Net ':all';
my $domain = IPv4(-not_in => [ ... ]);
$domain->inspect(...);

If you talk about this module in blogs, on del.icio.us or anywhere else, please use the datadomainsemanticadapter tag.

This document describes version 0.01 of Data::Domain::SemanticAdapter.

No bugs have been reported.
Please report any bugs or feature requests to <bug-data-domain-semanticadapter@rt.cpan.org>, or through the web interface at http://rt.cpan.org.

See perlmodinstall for information and options on installing Perl modules.

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a CPAN site near you. Or see <http://www.perl.com/CPAN/authors/id/M/MA/MARCEL/>.

Marcel Grünauer, <marcel@cpan.org>

Copyright 2007 by Marcel Grünauer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.