Moose::Meta::TypeConstraint man page on Kali

Man page or keyword search:  
man Server   9211 pages
apropos Keyword Search (all sections)
Output format
Kali logo
[printable version]

Moose::Meta::TypeConstUsertContributed Perl DoMoose::Meta::TypeConstraint(3pm)

NAME
       Moose::Meta::TypeConstraint - The Moose Type Constraint metaclass

VERSION
       version 2.2009

DESCRIPTION
       This class represents a single type constraint. Moose's built-in type
       constraints, as well as constraints you define, are all stored in a
       Moose::Meta::TypeConstraint::Registry object as objects of this class.

INHERITANCE
       "Moose::Meta::TypeConstraint" is a subclass of Class::MOP::Object.

METHODS
   Moose::Meta::TypeConstraint->new(%options)
       This creates a new type constraint based on the provided %options:

       ·   name

	   The constraint name. If a name is not provided, it will be set to
	   "__ANON__".

       ·   parent

	   A "Moose::Meta::TypeConstraint" object which is the parent type for
	   the type being created. This is optional.

       ·   constraint

	   This is the subroutine reference that implements the actual
	   constraint check. This defaults to a subroutine which always
	   returns true.

       ·   message

	   A subroutine reference which is used to generate an error message
	   when the constraint fails. This is optional.

       ·   coercion

	   A Moose::Meta::TypeCoercion object representing the coercions to
	   the type. This is optional.

       ·   inlined

	   A subroutine which returns a string suitable for inlining this type
	   constraint. It will be called as a method on the type constraint
	   object, and will receive a single additional parameter, a variable
	   name to be tested (usually "$_" or "$_[0]".

	   This is optional.

       ·   inline_environment

	   A hash reference of variables to close over. The keys are variables
	   names, and the values are references to the variables.

   $constraint->equals($type_name_or_object)
       Returns true if the supplied name or type object is the same as the
       current type.

   $constraint->is_subtype_of($type_name_or_object)
       Returns true if the supplied name or type object is a parent of the
       current type.

   $constraint->is_a_type_of($type_name_or_object)
       Returns true if the given type is the same as the current type, or is a
       parent of the current type. This is a shortcut for checking "equals"
       and "is_subtype_of".

   $constraint->coerce($value)
       This will attempt to coerce the value to the type. If the type does not
       have any defined coercions this will throw an error.

       If no coercion can produce a value matching $constraint, the original
       value is returned.

   $constraint->assert_coerce($value)
       This method behaves just like "coerce", but if the result is not valid
       according to $constraint, an error is thrown.

   $constraint->check($value)
       Returns true if the given value passes the constraint for the type.

   $constraint->validate($value)
       This is similar to "check". However, if the type is valid then the
       method returns an explicit "undef". If the type is not valid, we call
       "$self->get_message($value)" internally to generate an error message.

   $constraint->assert_valid($value)
       Like "check" and "validate", this method checks whether $value is valid
       under the constraint.  If it is, it will return true.  If it is not, an
       exception will be thrown with the results of
       "$self->get_message($value)".

   $constraint->name
       Returns the type's name, as provided to the constructor.

   $constraint->parent
       Returns the type's parent, as provided to the constructor, if any.

   $constraint->has_parent
       Returns true if the type has a parent type.

   $constraint->parents
       Returns all of the types parents as an list of type constraint objects.

   $constraint->constraint
       Returns the type's constraint, as provided to the constructor.

   $constraint->get_message($value)
       This generates a method for the given value. If the type does not have
       an explicit message, we generate a default message.

   $constraint->has_message
       Returns true if the type has a message.

   $constraint->message
       Returns the type's message as a subroutine reference.

   $constraint->coercion
       Returns the type's Moose::Meta::TypeCoercion object, if one exists.

   $constraint->has_coercion
       Returns true if the type has a coercion.

   $constraint->can_be_inlined
       Returns true if this type constraint can be inlined. A type constraint
       which subtypes an inlinable constraint and does not add an additional
       constraint "inherits" its parent type's inlining.

   $constraint->create_child_type(%options)
       This returns a new type constraint of the same class using the provided
       %options. The "parent" option will be the current type.

       This method exists so that subclasses of this class can override this
       behavior and change how child types are created.

BUGS
       See "BUGS" in Moose for details on reporting bugs.

AUTHORS
       ·   Stevan Little <stevan.little@iinteractive.com>

       ·   Dave Rolsky <autarch@urth.org>

       ·   Jesse Luehrs <doy@tozt.net>

       ·   Shawn M Moore <code@sartak.org>

       ·   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>

       ·   Karen Etheridge <ether@cpan.org>

       ·   Florian Ragwitz <rafl@debian.org>

       ·   Hans Dieter Pearcey <hdp@weftsoar.net>

       ·   Chris Prather <chris@prather.org>

       ·   Matt S Trout <mst@shadowcat.co.uk>

COPYRIGHT AND LICENSE
       This software is copyright (c) 2006 by Infinity Interactive, Inc.

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

perl v5.26.1			  2017-12-21  Moose::Meta::TypeConstraint(3pm)
[top]

List of man pages available for Kali

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net