From: Dave Rolsky Date: Sun, 16 Aug 2009 03:10:01 +0000 (-0500) Subject: Doc editing for Native Hash X-Git-Tag: 0.89_02~62 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8396a4370e597ac3aa4ce4f2bedfa2539887bb6b;hp=157e0475594f2c7d9316491578a38a3b018de3e7;p=gitmo%2FMoose.git Doc editing for Native Hash --- diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm b/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm index 8e4abbe..c23041d 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm @@ -47,13 +47,14 @@ Moose::Meta::Attribute::Native::Trait::Hash has_no_options => 'empty', num_options => 'count', delete_option => 'delete', + pairs => 'kv', } ); =head1 DESCRIPTION This module provides a Hash attribute which provides a number of -hash-like operations. +hash-like operations. =head1 PROVIDED METHODS @@ -62,29 +63,29 @@ L. =over 4 -=item B +=item B -Returns the number of elements in the hash. +Returns an element of the hash by its key. -=item B +=item B -If the hash is populated, returns false. Otherwise, returns true. +Sets the element in the hash at the given key to the given value. -=item B +=item B -Returns true if the given key is present in the hash. +Removes the element with the given key. -=item B +=item B -Returns true if the value of a given key is defined. +Returns the list of keys in the hash. -=item B +=item B -Returns an element of the hash by its key. +Returns true if the given key is present in the hash. -=item B +=item B -Returns the list of keys in the hash. +Returns true if the value of a given key is defined. =item B @@ -92,28 +93,32 @@ Returns the list of values in the hash. =item B -Returns the key, value pairs in the hash as array references. +Returns the key/value pairs in the hash as an array of array references. + + for my $pair ( $object->options->pairs ) { + print "$pair->[0] = $pair->[1]\n"; + } =item B -Returns the key, value pairs in the hash as a flattened list.. +Returns the key/value pairs in the hash as a flattened list.. -=item B +=item B -Removes the element with the given key. +Resets the hash to an empty value, like C<%hash = ()>. -=item B +=item B -Unsets the hash entirely. +Returns the number of elements in the hash. -=item B +=item B -Sets the element in the hash at the given key to the given value. +If the hash is populated, returns false. Otherwise, returns true. =item B -If passed one argument, returns the value of the requested key. If passed two -arguments, sets the value of the requested key. +If passed one argument, returns the value of the specified key. If passed two +arguments, sets the value of the specified key. =back