X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FVariable%2FMagic.pm;h=eca6f03446ca6599c4e1291d9e4a30e023ffca19;hb=refs%2Ftags%2Fv0.30;hp=27e482c33c19639b6204c9b87317aa0b9fc740f3;hpb=4928f1e28fe3594d29e214901ac76c7975eea7e0;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/lib/Variable/Magic.pm b/lib/Variable/Magic.pm index 27e482c..eca6f03 100644 --- a/lib/Variable/Magic.pm +++ b/lib/Variable/Magic.pm @@ -13,13 +13,13 @@ Variable::Magic - Associate user-defined magic to variables from Perl. =head1 VERSION -Version 0.29 +Version 0.30 =cut our $VERSION; BEGIN { - $VERSION = '0.29'; + $VERSION = '0.30'; } =head1 SYNOPSIS @@ -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]