Data::Object::Type
Data-Object Type Constraint Builder
package App::Type::Id; use parent 'Data::Object::Type'; sub name { return 'Id'; } sub parent { return 'Str'; } sub namespace { return 'App::Type::Library'; } sub validation { my ($self, $data) = @_; return 0 if !$data; return 0 if $data !~ /^\d+$/; return 1; }
Data::Object::Type is an abstract base class for type constraint builder classes.
This package implements the following methods.
aliases() : ArrayRef
The aliases method returns aliases to register in the type library.
my $aliases = $data->aliases();
coercion_generator(Object $arg1, Object $arg2, Object $arg3) : Object
coercion_generator
my $coercion_generator = $self->coercion_generator();
coercions() : ArrayRef
The coercions method returns coercions to configure on the type constraint.
my $coercions = $data->coercions();
const(Str $arg1, Any $arg2) : Any
constraint_generator
my $constraint_generator = $self->constraint_generator();
explaination(Object $arg1, Object $arg2, Str $arg3) : Any
The explaination_generator method returns the explaination for the type check failure.
my $explaination_generator = $self->explaination_generator();
library() : Any
The library method returns an instance of the type library instance.
my $library = $data->library();
name() : StrObject
The name method returns the name of the data type.
my $name = $data->name();
The namespace method returns the name of the data type.
my $namespace = $data->namespace();
new() : Object
Construct a new object.
my $data = Data::Object::Type->new();
options(Any $arg1) : (Str, Any)
The options method is used internally to create the options for building the Type::Tiny type constraint.
my $options = $data->options();
parent() : Str
The parent method represents the type expression (or parent type) that its type should derive from.
my $parent = $data->parent();
register() : DoType
The register method registers the built type constraint in the specified type library.
my $register = $data->register();
validation(Object $arg1) : NumObject
The validation method returns truthy if type check is valid.
my $validation = $self->validation();
validator() : Object
The validator method returns the built type constraint object.
my $validator = $data->validator();
To install Data::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Object
CPAN shell
perl -MCPAN -e shell install Data::Object
For more information on module installation, please visit the detailed CPAN module installation guide.