From: Vincent Pit Date: Sat, 27 Dec 2008 13:06:40 +0000 (+0100) Subject: Be a little clearer on how localize() handle sigils X-Git-Tag: v0.02~11 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScope-Upper.git;a=commitdiff_plain;h=ded0c62307dd417bbd7390457692310aca67ea93 Be a little clearer on how localize() handle sigils --- diff --git a/lib/Scope/Upper.pm b/lib/Scope/Upper.pm index 0835364..6128a8f 100644 --- a/lib/Scope/Upper.pm +++ b/lib/Scope/Upper.pm @@ -87,15 +87,16 @@ For example, if C<$value> is a scalar reference, then the C slot of the =item * -A string beginning with a sigil, representing the symbol to localize and assign to. -If the sigil is C<'$'>, then C<$value> isn't dereferenced, that is +A string beginning with a sigil, representing the symbol to localize and to assign to. +If the sigil is C<'$'>, L follows the same syntax as C, i.e. C<$value> isn't dereferenced. +For example, localize '$x', \'foo' => 0; will set C<$x> to a reference to the string C<'foo'>. -Other sigils behave as if a glob was passed. +Other sigils (C<'@'>, C<'%'>, C<'&'> and C<'*'>) require C<$value> to be a reference of the corresponding type. -The symbol is resolved when the actual localization takes place and not when C is called. +When the symbol is given by a string, it is resolved when the actual localization takes place and not when C is called. This means that sub tag { localize '$x', $_[0] => 1; }