Ask Solem > Class-Dot-2.0.0_15 > Class::Dot::Typemap

Download:
Class-Dot-2.0.0_15.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 2.0.0_15   Source  

NAME ^

Class::Dot::Typemap - Standard Type Constraints (Autogenerated)

VERSION ^

This document describes Class::Dot version 2.0.0_15

SYNOPSIS ^

    use Class::Dot::Typemap;
 
     # Get the type instance for a type
     my $type = find_type_constraint($type_name);
 
     # Resolve any aliases for a type name.
     $type_name = Class::Dot::Typemap->get_type($type_name)}
 
     # Get a subroutien ref to a function to check the type constraint. 
     my $check_constraint = Class::Dot::Typemap->get_compiled_constraint($type_name)
     my $is_valid_value   = 1 if $check_constraint->($value);
 
     # Get a list of the name for all standard types.
     my @std_types = Class::Dot::Typemap->get_types()
 
     # Get a hash of all type constraints.
     my %constraints = %{ Class::Dot::Typemap->type_constraints() };
 
     # Export all type constraints as functions to the current package.
     Class::Dot::Typemap->export_tyoe_constraints_as_functions();
 
     my $is_string  = String("hello");
     my $is_int     = Int(1000);
     my $is_not_int = Int(100.3);

DESCRIPTION ^

This is the map of standard type constraints.

WARNING This file is generated automatically by the Typemap program in the top of the Class::Dot distribution, so any changes to this file will be lost.

SUBROUTINES/METHODS ^

CLASS METHODS

find_type_constraint($type_name, [@default_values])

Get the type instance for a type by name. (Will be initialized with @default_value if given.)

INSTANCE METHODS

get_type($type_name)

Get the real type name for any type name.. (Resolve aliases).

get_compiled_constraint($type_name)

Get a function that can check if a value conforms to the type constraint $type_name.

Example:

     my $check_constraint = Class::Dot::Typemap->get_compiled_constraint('String');
     ok( $check_constraint->("hello world"), 'string is a string' );
     ok(not $check_constraint->([]), 'refernce to array is not a string');

get_types()

Get a list of names for all standard type constraints.

type_constraints()

Get a hash with all standard type constraints. The key is the name and the value is the reference to the constraint checking function.

export_type_constraints_as_functions()

Exports all type constraints as functions in the caller namespace with the type name as the name of the function.

E.g: String becomes String(), Int becomes Int() etc.

Example:

     Class::Dot::Typemap->export_tyoe_constraints_as_functions();
     ok( String("hello world"), 'string is a string' );
     ok(not String([]), 'refernce to array is not a string');

DIAGNOSTICS ^

Unknown type: %s

There is no type with that name.

CONFIGURATION AND ENVIRONMENT ^

This module requires no configuration file or environment variables.

DEPENDENCIES ^

INCOMPATIBILITIES ^

None known.

BUGS AND LIMITATIONS ^

No bugs have been reported.

Please report any bugs or feature requests to bug-class-dot@rt.cpan.org, or through the web interface at CPAN Bug tracker.

SEE ALSO ^

Class::Dot::Type

Class::Dot

Class::Dot::Manual

AUTHOR ^

Ask Solem, asksh@cpan.org.

LICENSE AND COPYRIGHT ^

Copyright (c), 2007 Ask Solem ask@0x61736b.net.

Class::Dot is distributed under the Modified BSD License.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

DISCLAIMER OF WARRANTY ^

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

# Local Variables: # mode: cperl # cperl-indent-level: 4 # fill-column: 78 # End: # vim: expandtab tabstop=4 shiftwidth=4 shiftround

syntax highlighting: