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 | |
8b9641b8 |
12 | use Moose::Role; |
13 | |
14 | with 'Moose::Meta::Method::Accessor::Native::Reader' => { |
15 | -excludes => [ |
16 | qw( |
17 | _minimum_arguments |
18 | _inline_check_arguments |
19 | ) |
20 | ], |
21 | }, |
22 | 'Moose::Meta::Method::Accessor::Native::Hash'; |
44babf1f |
23 | |
24 | sub _minimum_arguments { 1 } |
25 | |
44babf1f |
26 | sub _inline_check_arguments { |
27 | my $self = shift; |
28 | |
29 | return |
30 | 'for (@_) {' . "\n" |
31 | . $self->_inline_check_var_is_valid_key('$_') . "\n" . '}'; |
32 | } |
33 | |
34 | sub _return_value { |
35 | my $self = shift; |
36 | my $slot_access = shift; |
37 | |
38 | return "\@_ > 1 ? \@{ $slot_access }{\@_} : ${slot_access}->{ \$_[0] }"; |
39 | } |
40 | |
8b9641b8 |
41 | no Moose::Role; |
44babf1f |
42 | |
43 | 1; |