-
-
07 Nov 2021 03:41:58 UTC
- Distribution: Moose
- Module version: 2.2201
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (71)
- Testers (2689 / 3 / 1)
- Kwalitee
Bus factor: 3- 92.11% Coverage
- License: perl_5
- Perl: v5.8.3
- Activity
24 month- Tools
- Download (881.54KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 142 contributors-
Stevan Little
-
Dave Rolsky
-
Jesse Luehrs
-
Shawn M Moore
-
יובל קוג'מן (Yuval Kogman)
-
Florian Ragwitz
-
Hans Dieter Pearcey
-
Chris Prather
-
Matt S Trout
-
Upasana Shukla
-
Graham Knop
-
Tomas Doran
-
Ricardo Signes
-
Guillermo Roditi
-
John Napiorkowski
-
Aankhen
-
Todd Hepler
-
Jonathan Rockway
-
Gerda Shank
-
Perlover
-
Shlomi Fish
-
Brad Bowman
-
Justin Hunter
-
Kent Fredric
-
Paul Driver
-
Anders Nor Berle
-
Brian Manning
-
gfx
-
Jay Hannah
-
Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯
-
Leon Brocard
-
Olivier Mengué
-
Rafael Kitover
-
Christian Hansen
-
Cory Watson
-
Dagfinn Ilmari Mannsåker
-
Paul Jamieson Fenwick
-
Robert Buels
-
Dan Dascalescu
-
Marcel Grünauer
-
Scott McWhirter
-
Ævar Arnfjörð Bjarmason
-
Daisuke Maki (lestrrat)
-
Dylan William Hardison
-
Patrick Donelan
-
Stefan O'Rear
-
Tokuhiro Matsuno
-
Ash Berlin
-
Chris Weyl
-
Eric Wilhelm
-
Jess Robinson
-
Marc Mims
-
Marcus Ramberg
-
Mark Allen
-
Mateu X Hunter
-
matthof
-
Robert 'phaylon' Sedlacek
-
Zachary Lome
-
Aran Clary Deltac
-
Chip
-
Christopher J. Madsen
-
Curtis Jewell
-
Evan Carroll
-
Mark A. Stratman
-
Mark Fowler
-
Matthew Horsfall
-
mauke
-
Michael LaGrasta
-
Michael Rykov
-
Mike Whitaker
-
Moritz Onken
-
Nelo Onyiah
-
Nick Perez
-
Robert Boone
-
Robin V
-
rodrigolive
-
shelling
-
Thomas Sibley
-
Tom Hukins
-
Wallace Reis
-
Aaron Cohen
-
Adam J. Foxson
-
Adam Kennedy
-
Andy Jack
-
Anirvan Chatterjee
-
Ansgar Burchardt
-
A. Sinan Unur
-
Ben Hutton
-
Brendan Byrd
-
Chad Granum
-
Chankey Pathak
-
Chia-liang Kao
-
Christian Walde (Mithaldu)
-
chromatic
-
Dann
-
Dave Romano
-
David Leadbeater
-
David Steinbrunner
-
dmaestro
-
E. Choroba
-
franck cuny
-
Frew Schmidt
-
gregor herrmann
-
hakim
-
Henry Van Styn
-
James Marca
-
Jason May
-
Jay Allen
-
Jay Kuri
-
Jeff Bisbee
-
Jens Berthold
-
Jesse Vincent
-
joel
-
John Douglas Porter
-
John Goulah
-
Justin DeVuyst
-
Kang-min Liu
-
Leon Timmermans
-
Mark O Grady
-
Matt Kraai
-
Michael Schout
-
Nathan Gray
-
Olaf Alders
-
Olof Johansson
-
Paul Cochrane
-
Paweł Murias
-
Pedro Melo
-
Peter Shangov
-
Philippe Bruhat (BooK)
-
Philipp Gortan
-
Phillip Smith
-
Piotr Roszatycki
-
pktm
-
rouzier
-
Sam Vilain
-
sherrardb
-
Simon Reinhardt
-
sue spence
-
Tuomas Jormola
-
wickline
-
Yanick Champoux
-
Zoffix Znet
- Dependencies
- Carp
- Class::Load
- Class::Load::XS
- Data::OptList
- Devel::GlobalDestruction
- Devel::OverloadInfo
- Devel::StackTrace
- Dist::CheckConflicts
- Eval::Closure
- List::Util
- MRO::Compat
- Module::Runtime
- Module::Runtime::Conflicts
- Package::DeprecationManager
- Package::Stash
- Package::Stash::XS
- Params::Util
- Scalar::Util
- Sub::Exporter
- Sub::Util
- Try::Tiny
- parent
- strict
- warnings
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- VERSION
- DESCRIPTION
- INHERITANCE
- METHODS
- Moose::Meta::TypeConstraint->new(%options)
- $constraint->equals($type_name_or_object)
- $constraint->is_subtype_of($type_name_or_object)
- $constraint->is_a_type_of($type_name_or_object)
- $constraint->coerce($value)
- $constraint->assert_coerce($value)
- $constraint->check($value)
- $constraint->validate($value)
- $constraint->assert_valid($value)
- $constraint->name
- $constraint->parent
- $constraint->has_parent
- $constraint->parents
- $constraint->constraint
- $constraint->get_message($value)
- $constraint->has_message
- $constraint->message
- $constraint->coercion
- $constraint->has_coercion
- $constraint->can_be_inlined
- $constraint->create_child_type(%options)
- BUGS
- AUTHORS
- COPYRIGHT AND LICENSE
NAME
Moose::Meta::TypeConstraint - The Moose Type Constraint metaclass
VERSION
version 2.2201
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
andis_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 explicitundef
. If the type is not valid, we call$self->get_message($value)
internally to generate an error message.$constraint->assert_valid($value)
Like
check
andvalidate
, 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
. Theparent
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@cpan.org>
Dave Rolsky <autarch@urth.org>
Jesse Luehrs <doy@cpan.org>
Shawn M Moore <sartak@cpan.org>
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
Karen Etheridge <ether@cpan.org>
Florian Ragwitz <rafl@debian.org>
Hans Dieter Pearcey <hdp@cpan.org>
Chris Prather <chris@prather.org>
Matt S Trout <mstrout@cpan.org>
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.
Module Install Instructions
To install Moose, copy and paste the appropriate command in to your terminal.
cpanm Moose
perl -MCPAN -e shell install Moose
For more information on module installation, please visit the detailed CPAN module installation guide.