Commit | Line | Data |
44babf1f |
1 | package Moose::Meta::Method::Accessor::Native::Hash::get; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Scalar::Util qw( looks_like_number ); |
7 | |
10bd99ec |
8 | our $VERSION = '1.14'; |
44babf1f |
9 | $VERSION = eval $VERSION; |
10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | |
12 | use base 'Moose::Meta::Method::Accessor::Native::Reader'; |
13 | |
14 | Class::MOP::MiniTrait::apply( __PACKAGE__, |
15 | 'Moose::Meta::Method::Accessor::Native::Hash' |
16 | ); |
17 | |
18 | sub _minimum_arguments { 1 } |
19 | |
20 | sub _maximum_arguments { undef } |
21 | |
22 | sub _inline_check_arguments { |
23 | my $self = shift; |
24 | |
25 | return |
26 | 'for (@_) {' . "\n" |
27 | . $self->_inline_check_var_is_valid_key('$_') . "\n" . '}'; |
28 | } |
29 | |
30 | sub _return_value { |
31 | my $self = shift; |
32 | my $slot_access = shift; |
33 | |
34 | return "\@_ > 1 ? \@{ $slot_access }{\@_} : ${slot_access}->{ \$_[0] }"; |
35 | } |
36 | |
37 | |
38 | 1; |