use strict;
use warnings;
-use B;
+use Moose::Role;
+
use Scalar::Util qw( looks_like_number );
-our $VERSION = '1.13';
+our $VERSION = '1.19';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
-use base 'Moose::Meta::Method::Accessor::Native';
-
-sub _inline_curried_arguments {
+sub _inline_check_var_is_valid_index {
my $self = shift;
-
- return q{} unless @{ $self->curried_arguments };
-
- return "\@_ = ( \@curried, \@_ );";
+ my ($var) = @_;
+
+ return (
+ 'if (!defined(' . $var . ') || ' . $var . ' !~ /^-?\d+$/) {',
+ $self->_inline_throw_error(
+ '"The index passed to ' . $self->delegate_to_method
+ . ' must be an integer"',
+ ) . ';',
+ '}',
+ );
}
-sub _inline_check_constraint {
- my $self = shift;
-
- return q{} unless $self->_constraint_must_be_checked;
-
- return $self->SUPER::_inline_check_constraint(@_);
-}
-
-sub _constraint_must_be_checked {
- my $self = shift;
-
- my $attr = $self->associated_attribute;
-
- return $attr->has_type_constraint
- && ( $attr->type_constraint->name ne 'ArrayRef'
- || ( $attr->should_coerce && $attr->type_constraint->has_coercion ) );
-}
+no Moose::Role;
1;