From: Gerda Shank Date: Sun, 6 Sep 2009 14:33:05 +0000 (-0400) Subject: minor native trait doc tweaks X-Git-Tag: 0.89_02~33^2~5^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=39e17fefc57ae6d0a5c495e1fe7d90cdef1694c5;p=gitmo%2FMoose.git minor native trait doc tweaks --- diff --git a/lib/Moose/Manual/Attributes.pod b/lib/Moose/Manual/Attributes.pod index b1a8eaf..921301a 100644 --- a/lib/Moose/Manual/Attributes.pod +++ b/lib/Moose/Manual/Attributes.pod @@ -539,7 +539,12 @@ traits for the attribute: ); In this case, the metaclass C really refers to -L. +L. Moose also provides +native traits for L, +L, +L, +L, and +L. You can also apply one or more traits to an attribute: diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Array.pm b/lib/Moose/Meta/Attribute/Native/Trait/Array.pm index 5f9b8e9..7e98127 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Array.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Array.pm @@ -43,12 +43,14 @@ Moose::Meta::Attribute::Native::Trait::Array default => sub { [] }, handles => { all_options => 'elements', + add_option => 'push', map_options => 'map', filter_options => 'grep', find_option => 'first', get_option => 'get', join_options => 'join', count_options => 'count', + has_options => 'count', has_no_options => 'is_empty', sorted_options => 'sort', }, @@ -102,11 +104,11 @@ numbers, just as with Perl's core array handling. =item B -=item B +=item B =item B -=item B +=item B =item B diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm b/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm index 999bbc8..4d17810 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm @@ -70,7 +70,7 @@ Returns values from the hash. In list context return a list of values in the hash for the given keys. In scalar context returns the value for the last key specified. -=item B $value, $key2 => $value2 ...)> +=item B $value, $key2 =E $value2 ...)> Sets the elements in the hash to the given values. @@ -112,7 +112,8 @@ Resets the hash to an empty value, like C<%hash = ()>. =item B -Returns the number of elements in the hash. +Returns the number of elements in the hash. Also useful for not empty: +C<< has_options => 'count' >>. =item B