Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

class::meta::types::perl(3pm) [debian man page]

Class::Meta::Types::Perl(3pm)				User Contributed Perl Documentation			     Class::Meta::Types::Perl(3pm)

NAME
Class::Meta::Types::Perl - Perl data types SYNOPSIS
package MyApp::Thingy; use strict; use Class::Meta; use Class::Meta::Types::Perl; # OR... # use Class::Meta::Types::Perl 'affordance'; # OR... # use Class::Meta::Types::Perl 'semi-affordance'; BEGIN { # Create a Class::Meta object for this class. my $cm = Class::Meta->new( key => 'thingy' ); # Add an integer attribute. $cm->add_attribute( name => 'my_hash', type => 'hash' ); $cm->build; } DESCRIPTION
This module provides Perl data types for use with Class::Meta attributes. Simply load it, then pass the name of one of its types to the "add_attribute()" method of a Class::Meta object. See Class::Meta::Type for more information on using and creating data types. The validation checks for Class::Meta::Types::Perl are provided by the Class::Meta::Type's support for object type validation, since Perl data types are understood by "UNIVERSAL::isa()". The data types created by Class::Meta::Types::Perl are: scalar A simple scalar value. This can be anything, and has no validation checks. scalarref A scalar reference. "UNIVERSAL::isa()" must return 'SCALAR'. array arrayref A array reference. "UNIVERSAL::isa()" must return 'ARRAY'. hash hashref A hash reference. "UNIVERSAL::isa()" must return 'HASH'. code coderef closure A code reference. Also known as a closure. "UNIVERSAL::isa()" must return 'CODE'. SUPPORT
This module is stored in an open GitHub repository <http://github.com/theory/class-meta/>. Feel free to fork and contribute! Please file bug reports via GitHub Issues <http://github.com/theory/class-meta/issues/> or by sending mail to bug-Class-Meta.cpan.org <mailto:bug-Class-Meta.cpan.org>. AUTHOR
David E. Wheeler <david@justatheory.com> SEE ALSO
Other classes of interest within the Class::Meta distribution include: Class::Meta This class contains most of the documentation you need to get started with Class::Meta. Class::Meta::Type This class manages the creation of data types. Class::Meta::Attribute This class manages Class::Meta class attributes, all of which are based on data types. Other data type modules: Class::Meta::Types::String Class::Meta::Types::Boolean Class::Meta::Types::Numeric COPYRIGHT AND LICENSE
Copyright (c) 2002-2011, David E. Wheeler. Some Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2011-08-06 Class::Meta::Types::Perl(3pm)

Check Out this Related Man Page

Class::Meta::Types::Boolean(3pm)			User Contributed Perl Documentation			  Class::Meta::Types::Boolean(3pm)

NAME
Class::Meta::Types::Boolean - Boolean data types SYNOPSIS
package MyApp::Thingy; use strict; use Class::Meta; use Class::Meta::Types::Boolean; # OR... # use Class::Meta::Types::Boolean 'affordance'; # OR... # use Class::Meta::Types::Boolean 'semi-affordance'; BEGIN { # Create a Class::Meta object for this class. my $cm = Class::Meta->new( key => 'thingy' ); # Add a boolean attribute. $cm->add_attribute( name => 'alive', type => 'boolean' ); $cm->build; } DESCRIPTION
This module provides a boolean data type for use with Class::Meta attributes. Simply load it, then pass "boolean" (or the alias "bool") to the "add_attribute()" method of a Class::Meta object to create an attribute of the boolean data type. See Class::Meta::Type for more information on using and creating data types. Accessors Although the boolean data type has both "default" and "affordance" accessor options available, unlike the other data types that ship with Class::Meta, they have different implementations. The reason for this is to ensure that the value of a boolean attribute is always 0 or 1. For the "default" accessor style, there is no difference in the interface from the default accessors for other data types. The default accessor merely checks the truth of the new value, and assigns 1 if it's a true value, and 0 if it's a false value. The result is an efficient accessor that maintains the consistency of the data. For the "affordance" accessor style, however, the boolean data type varies in the accessors it creates. For example, for a boolean attributed named "alive", instead of creating the "get_alive" and "set_alive" accessors common to other affordance-style accessors, it instead creates three: "is_alive" "set_alive_on" "set_alive_off" The result is highly efficient accessors that ensure the integrity of the data without the overhead of validation checks. SUPPORT
This module is stored in an open GitHub repository <http://github.com/theory/class-meta/>. Feel free to fork and contribute! Please file bug reports via GitHub Issues <http://github.com/theory/class-meta/issues/> or by sending mail to bug-Class-Meta.cpan.org <mailto:bug-Class-Meta.cpan.org>. AUTHOR
David E. Wheeler <david@justatheory.com> SEE ALSO
Other classes of interest within the Class::Meta distribution include: Class::Meta This class contains most of the documentation you need to get started with Class::Meta. Class::Meta::Type This class manages the creation of data types. Class::Meta::Attribute This class manages Class::Meta class attributes, all of which are based on data types. Other data type modules: Class::Meta::Types::Perl Class::Meta::Types::String Class::Meta::Types::Numeric COPYRIGHT AND LICENSE
Copyright (c) 2002-2011, David E. Wheeler. Some Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2011-08-06 Class::Meta::Types::Boolean(3pm)
Man Page