Steven Haryanto > Data-Schema > Data::Schema::Type::TypeName

Download:
Data-Schema-0.136.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.136   Source  

NAME ^

Data::Schema::Type::TypeName - Type handler for DS type 'typename'

VERSION ^

version 0.136

SYNOPSIS ^

 use Data::Schema;

DESCRIPTION ^

This is type handler for 'typename'. It is just like string, except it only accepts valid type names (/^[a-z][a-z0-9_]$/).

This is used for validating DS schemas and does not have much use elsewhere.

Example:

 ds_validate("int", "typename"); # valid
 ds_validate("integer number", "typename"); # invalid, contains whitespace

TYPE ATTRIBUTES ^

Aside from attributes from string, here are other recognized attributes:

known => BOOL

If true, require that type name is known at that point of the validation.

Example:

 ds_validate("foo", [typename=>{known=>1}); # invalid, foo is not a known type
 ds_validate("foo", {def => {foo=>"str"}, 
                     attr_hashes => [{known=>1}], 
                     type => "typename"}); # valid, foo is known here

isa_schema => BOOL

If true, require that type name is a schema type.

Example:

 ds_validate("int", [typename=>{isa_schema=>1}]); # invalid, int is not a schema type
 ds_validate("foo", [typename=>{isa_schema=>1}]); # valid if foo is a schema type

SEE ALSO ^

Data::Schema::Type::Str

Data::Schema::Schema::Schema

AUTHOR ^

  Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2009 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: