1Moose::Meta::TypeCoerciUosne(r3)Contributed Perl DocumenMtoaotsieo:n:Meta::TypeCoercion(3)
2
3
4
6 Moose::Meta::TypeCoercion - The Moose Type Coercion metaclass
7
9 A type coercion object is basically a mapping of one or more type
10 constraints and the associated coercions subroutines.
11
12 It's unlikely that you will need to instantiate an object of this class
13 directly, as it's part of the deep internals of Moose.
14
16 Moose::Meta::TypeCoercion->new(%options)
17 Creates a new type coercion object, based on the options provided.
18
19 ยท type_constraint
20
21 This is the Moose::Meta::TypeConstraint object for the type
22 that is being coerced to.
23
24 $coercion->type_coercion_map
25 This returns the map of type constraints to coercions as an array
26 reference. The values of the array alternate between type names and
27 subroutine references which implement the coercion.
28
29 The value is an array reference because coercions are tried in the
30 order they are added.
31
32 $coercion->type_constraint
33 This returns the Moose::Meta::TypeConstraint that was passed to the
34 constructor.
35
36 $coercion->has_coercion_for_type($type_name)
37 Returns true if the coercion can coerce the named type.
38
39 $coercion->add_type_coercions( $type_name => $sub, ... )
40 This method takes a list of type names and subroutine references.
41 If the coercion already has a mapping for a given type, it throws
42 an exception.
43
44 Coercions are actually
45
46 $coercion->coerce($value)
47 This method takes a value and applies the first valid coercion it
48 finds.
49
50 This means that if the value could belong to more than type in the
51 coercion object, the first coercion added is used.
52
53 Moose::Meta::TypeCoercion->meta
54 This will return a Class::MOP::Class instance for this class.
55
57 See "BUGS" in Moose for details on reporting bugs.
58
60 Stevan Little <stevan@iinteractive.com>
61
63 Copyright 2006-2010 by Infinity Interactive, Inc.
64
65 <http://www.iinteractive.com>
66
67 This library is free software; you can redistribute it and/or modify it
68 under the same terms as Perl itself.
69
70
71
72perl v5.12.2 2010-08-28 Moose::Meta::TypeCoercion(3)