From: Vincent Pit Date: Thu, 12 Feb 2009 16:55:10 +0000 (+0100) Subject: Document magic on array/hash values X-Git-Tag: v0.30~1 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=4d390b48e044d734803433486830972416f03d59;p=perl%2Fmodules%2FVariable-Magic.git Document magic on array/hash values --- diff --git a/lib/Variable/Magic.pm b/lib/Variable/Magic.pm index 27e482c..e09ef04 100644 --- a/lib/Variable/Magic.pm +++ b/lib/Variable/Magic.pm @@ -423,6 +423,15 @@ If the variable isn't a hash, any C callback of the wizard is safely ignor my $x; die 'error' unless cast $x, $wiz; +The C argument can be an array or hash value. +Magic for those behaves like for any other scalar, except that it is dispelled when the entry is deleted from the container. +For example, if you want to call C each time the C<'TZ'> environment variable is changed in C<%ENV>, you can use : + + use POSIX; + cast $ENV{TZ}, wizard set => sub { POSIX::tzset(); () }; + +If you want to overcome the possible deletion of the C<'TZ'> entry, you have no choice but to rely on C uvar magic. + =head2 C getdata [$@%&*]var, [$wiz|$sig]