autoboxing
[gitmo/Moose-Autobox.git] / lib / Moose / Autobox / Hash.pm
CommitLineData
5f654d8e 1package Moose::Autobox::Hash;
2use Moose::Role 'with';
3
4our $VERSION = '0.01';
5
6cf5bcf2 6with 'Moose::Autobox::Ref',
7 'Moose::Autobox::Indexed';
8
9sub delete {
10 my ($hash, $key) = @_;
11 CORE::delete $hash->{$key};
12}
13
14# ::Indexed implementation
5f654d8e 15
16sub exists {
17 my ($hash, $key) = @_;
18 CORE::exists $hash->{$key};
19}
e6bb88b0 20
5f654d8e 21sub keys {
22 my ($hash) = @_;
e6bb88b0 23 [ CORE::keys %$hash ];
5f654d8e 24}
25
26sub values {
27 my ($hash) = @_;
e6bb88b0 28 [ CORE::values %$hash ];
29}
30
31sub kv {
32 my ($hash) = @_;
33 [ CORE::map { [ $_, $hash->{$_} ] } CORE::keys %$hash ];
5f654d8e 34}
35
361;