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