package Moose::Meta::Attribute::Native::Trait::Hash;
use Moose::Role;
-our $VERSION = '1.16';
-$VERSION = eval $VERSION;
-our $AUTHORITY = 'cpan:STEVAN';
-
-use Moose::Meta::Method::Accessor::Native::Hash::accessor;
-use Moose::Meta::Method::Accessor::Native::Hash::clear;
-use Moose::Meta::Method::Accessor::Native::Hash::count;
-use Moose::Meta::Method::Accessor::Native::Hash::defined;
-use Moose::Meta::Method::Accessor::Native::Hash::delete;
-use Moose::Meta::Method::Accessor::Native::Hash::elements;
-use Moose::Meta::Method::Accessor::Native::Hash::exists;
-use Moose::Meta::Method::Accessor::Native::Hash::get;
-use Moose::Meta::Method::Accessor::Native::Hash::is_empty;
-use Moose::Meta::Method::Accessor::Native::Hash::keys;
-use Moose::Meta::Method::Accessor::Native::Hash::kv;
-use Moose::Meta::Method::Accessor::Native::Hash::set;
-use Moose::Meta::Method::Accessor::Native::Hash::values;
-
with 'Moose::Meta::Attribute::Native::Trait';
sub _helper_type { 'HashRef' }
1;
+# ABSTRACT: Helper trait for HashRef attributes
+
__END__
=pod
-=head1 NAME
-
-Moose::Meta::Attribute::Native::Trait::Hash - Helper trait for HashRef attributes
-
=head1 SYNOPSIS
package Stuff;
=head1 DESCRIPTION
-This trait provides native delegation methods for array references.
+This trait provides native delegation methods for hash references.
=head1 PROVIDED METHODS
Returns the key/value pairs in the hash as an array of array references.
- for my $pair ( $object->options->pairs ) {
+ for my $pair ( $object->options->kv ) {
print "$pair->[0] = $pair->[1]\n";
}
=item B<count>
-Returns the number of elements in the hash. Also useful for not empty:
+Returns the number of elements in the hash. Also useful for not empty:
C<< has_options => 'count' >>.
This method does not accept any arguments.
When called as a setter, this method returns the value that was set.
+=item B<shallow_clone>
+
+This method returns a shallow clone of the hash reference. The return value
+is a reference to a new hash with the same keys and values. It is I<shallow>
+because any values that were references in the original will be the I<same>
+references in the clone.
+
=back
+Note that C<each> is deliberately omitted, due to its stateful interaction
+with the hash iterator. C<keys> or C<kv> are much safer.
+
=head1 METHODS
=over 4
See L<Moose/BUGS> for details on reporting bugs.
-=head1 AUTHOR
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2009 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
=cut