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 version 2.2012
10
12 A type coercion object is basically a mapping of one or more type
13 constraints and the associated coercions subroutines.
14
15 It's unlikely that you will need to instantiate an object of this class
16 directly, as it's part of the deep internals of Moose.
17
19 Moose::Meta::TypeCoercion->new(%options)
20 Creates a new type coercion object, based on the options provided.
21
22 · type_constraint
23
24 This is the Moose::Meta::TypeConstraint object for the type that is
25 being coerced to.
26
27 $coercion->type_coercion_map
28 This returns the map of type constraints to coercions as an array
29 reference. The values of the array alternate between type names and
30 subroutine references which implement the coercion.
31
32 The value is an array reference because coercions are tried in the
33 order they are added.
34
35 $coercion->type_constraint
36 This returns the Moose::Meta::TypeConstraint that was passed to the
37 constructor.
38
39 $coercion->has_coercion_for_type($type_name)
40 Returns true if the coercion can coerce the named type.
41
42 $coercion->add_type_coercions( $type_name => $sub, ... )
43 This method takes a list of type names and subroutine references. If
44 the coercion already has a mapping for a given type, it throws an
45 exception.
46
47 Coercions are actually
48
49 $coercion->coerce($value)
50 This method takes a value and applies the first valid coercion it
51 finds.
52
53 This means that if the value could belong to more than type in the
54 coercion object, the first coercion added is used.
55
56 Moose::Meta::TypeCoercion->meta
57 This will return a Class::MOP::Class instance for this class.
58
60 See "BUGS" in Moose for details on reporting bugs.
61
63 · Stevan Little <stevan.little@iinteractive.com>
64
65 · Dave Rolsky <autarch@urth.org>
66
67 · Jesse Luehrs <doy@tozt.net>
68
69 · Shawn M Moore <code@sartak.org>
70
71 · יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
72
73 · Karen Etheridge <ether@cpan.org>
74
75 · Florian Ragwitz <rafl@debian.org>
76
77 · Hans Dieter Pearcey <hdp@weftsoar.net>
78
79 · Chris Prather <chris@prather.org>
80
81 · Matt S Trout <mst@shadowcat.co.uk>
82
84 This software is copyright (c) 2006 by Infinity Interactive, Inc.
85
86 This is free software; you can redistribute it and/or modify it under
87 the same terms as the Perl 5 programming language system itself.
88
89
90
91perl v5.30.1 2020-01-30 Moose::Meta::TypeCoercion(3)