diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Array.pm b/lib/Moose/Meta/Attribute/Native/Trait/Array.pm index 6603d4c4f..9cfc45047 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Array.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Array.pm @@ -78,10 +78,13 @@ This method does not accept any arguments. =item * B -Returns all of the elements of the array as an array (not an array reference). +In list context, returns all of the elements of the array as a list. + +In scalar context, returns the number of elements in the array. my @option = $stuff->all_options; - print "@options\n"; # prints "foo bar baz boo" + print "@options"; # prints "foo bar baz boo" + print scalar $stuff->all_options; # prints 4 This method does not accept any arguments. diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm b/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm index 5b3562af5..7897229da 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm @@ -102,7 +102,10 @@ This method does not accept any arguments. =head2 elements -Returns the key/value pairs in the hash as a flattened list.. +In list context, this returns the key/value pairs in the hash. + +In scalar context, this returns the count of keys plus values. In other words, +it's the same as L times two. This method does not accept any arguments.