1 package Moose::Autobox::Hash;
2 use Moose::Role 'with';
8 with 'Moose::Autobox::Ref',
9 'Moose::Autobox::Indexed';
12 my ($hash, $key) = @_;
13 CORE::delete $hash->{$key};
17 my ($left, $right) = @_;
18 croak "You must pass a hashref as argument to merge"
19 unless ref $right eq 'HASH';
20 return { %$left, %$right };
23 # ::Indexed implementation
26 my ($hash, $index) = @_;
31 my ($hash, $index, $value) = @_;
32 $hash->{$index} = $value;
36 my ($hash, $key) = @_;
37 CORE::exists $hash->{$key};
42 [ CORE::keys %$hash ];
47 [ CORE::values %$hash ];
52 [ CORE::map { [ $_, $hash->{$_} ] } CORE::keys %$hash ];
63 Moose::Autobox::Hash - the Hash role
69 print { one => 1, two => 2 }->keys->join(', '); # prints 'one, two'
73 This is a role to describes a Hash value.
83 Takes a hashref and returns a new hashref with right precedence
88 =head2 Indexed implementation
114 All complex software has bugs lurking in it, and this module is no
115 exception. If you find a bug please either email me, or add the bug
120 Stevan Little E<lt>stevan@iinteractive.comE<gt>
122 Anders Nor Berle E<lt>debolaz@gmail.comE<gt>
124 =head1 COPYRIGHT AND LICENSE
126 Copyright 2006 by Infinity Interactive, Inc.
128 L<http://www.iinteractive.com>
130 This library is free software; you can redistribute it and/or modify
131 it under the same terms as Perl itself.