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