1 package MooseX::Meta::TypeCoercion::Structured::Optional;
4 extends 'Moose::Meta::TypeCoercion';
6 =method compile_type_coercion
10 sub compile_type_coercion {
12 my $constraint = $self->type_constraint->type_parameter;
14 $self->_compiled_type_coercion(sub {
16 return unless $constraint->has_coercion;
17 return $constraint->coerce($value);
21 sub has_coercion_for_type { 0 }
23 sub add_type_coercions {
24 Moose->throw_error("Cannot add additional type coercions to Optional types");
27 __PACKAGE__->meta->make_immutable(inline_constructor => 0);