. ')'
};
+ my $value_type = Moose::Util::TypeConstraints::find_type_constraint('Value');
subtype 'Num'
=> as 'Str'
=> where { Scalar::Util::looks_like_number($_) }
=> inline_as {
# the long Str tests are redundant here
- Moose::Util::TypeConstraints::find_type_constraint('Value')->_inline_check($_[1])
+ $value_type->_inline_check($_[1])
. ' && Scalar::Util::looks_like_number(' . $_[1] . ')'
};
=> as 'Num'
=> where { (my $val = $_) =~ /\A-?[0-9]+\z/ }
=> inline_as {
- Moose::Util::TypeConstraints::find_type_constraint('Value')->_inline_check($_[1])
+ $value_type->_inline_check($_[1])
. ' && (my $val = ' . $_[1] . ') =~ /\A-?[0-9]+\z/'
};