1 package ## Hide from PAUSE
2 MooseX::Meta::TypeCoercion::Structured::Optional;
5 extends 'Moose::Meta::TypeCoercion';
7 =method compile_type_coercion
11 sub compile_type_coercion {
13 my $constraint = $self->type_constraint->type_parameter;
15 $self->_compiled_type_coercion(sub {
17 return unless $constraint->has_coercion;
18 return $constraint->coerce($value);
22 sub has_coercion_for_type { 0 }
24 sub add_type_coercions {
25 Moose->throw_error("Cannot add additional type coercions to Optional types");
28 __PACKAGE__->meta->make_immutable(inline_constructor => 0);