bool => sub { 1 },
fallback => 1;
+use Eval::Closure;
use Scalar::Util qw(blessed refaddr);
use Sub::Name qw(subname);
use Try::Tiny;
if $self->has_hand_optimized_type_constraint;
if ( $self->has_inlined_type_constraint ) {
- local $@;
- my $sub = eval 'sub { ' . $self->_inline_check('$_[0]') . '}';
- die $@ if $@;
-
- return $sub;
+ return eval_closure(
+ source => 'sub { ' . $self->_inline_check('$_[0]') . ' }',
+ );
}
my $check = $self->constraint;