X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2Fautovivification.pm;h=bff3f85855b87d410fec9a338fd07955d6e358b6;hb=8859c942066d3fbb04190a766d970c0311e86562;hp=825eb9976dceefb7d1cff06d9b101fc3b1091e22;hpb=2966b83e4eb41f8bd7f8c354e078bce07ced1fea;p=perl%2Fmodules%2Fautovivification.git diff --git a/lib/autovivification.pm b/lib/autovivification.pm index 825eb99..bff3f85 100644 --- a/lib/autovivification.pm +++ b/lib/autovivification.pm @@ -11,13 +11,13 @@ autovivification - Lexically disable autovivification. =head1 VERSION -Version 0.01 +Version 0.03 =cut our $VERSION; BEGIN { - $VERSION = '0.01'; + $VERSION = '0.03'; } =head1 SYNOPSIS @@ -64,8 +64,8 @@ Enables the features given in C<@opts>, which can be : C<'fetch'> -Turn off autovivification for rvalue dereferencing expressions, such as C<< $value = $hashref->{key}[$idx]{$field} >>. -C is returned when the expression would have autovivified. +Turn off autovivification for rvalue dereferencing expressions, such as C<< $value = $hashref->{key}[$idx]{$field} >>, C<< keys %{$hashref->{key}} >> or C<< values %{$hashref->{key}} >>. +When the expression would have autovivified, C is returned for a plain fetch, while C and C return C<0> in scalar context and the empty list in list context. =item * @@ -85,7 +85,7 @@ C is returned when the expression would have autovivified. C<'store'> -Turn off autovivification for lvalue dereferencing expressions, such as C<< $hashref->{key}[$idx]{$field} = $value >>. +Turn off autovivification for lvalue dereferencing expressions, such as C<< $hashref->{key}[$idx]{$field} = $value >> or C<< for ($hashref->{key}[$idx]{$field}) { ... } >>. An exception is thrown if vivification is needed to store the value, which means that effectively you can only assign to levels that are already defined (in the example, this would require C<< $hashref->{key}[$idx] >> to already be a hash reference). =item *