+Note that I<free> magic is never called during global destruction, as there is no way to ensure that the wizard object and the callback were not destroyed before the variable.
+
+Here is a simple usage example :
+
+ # A simple scalar tracer
+ my $wiz = wizard(
+ get => sub { print STDERR "got ${$_[0]}\n" },
+ set => sub { print STDERR "set to ${$_[0]}\n" },
+ free => sub { print STDERR "${$_[0]} was deleted\n" },
+ );
+
+=cut
+
+sub wizard {
+ if (@_ % 2) {
+ require Carp;
+ Carp::croak('Wrong number of arguments for wizard()');
+ }
+
+ my %opts = @_;
+
+ my @keys = qw<op_info data get set len clear free copy dup>;
+ push @keys, 'local' if MGf_LOCAL;
+ push @keys, qw<fetch store exists delete copy_key> if VMG_UVAR;
+
+ my ($wiz, $err);
+ {
+ local $@;
+ $wiz = eval { _wizard(map $opts{$_}, @keys) };
+ $err = $@;
+ }
+ if ($err) {
+ $err =~ s/\sat\s+.*?\n//;
+ require Carp;
+ Carp::croak($err);
+ }
+
+ return $wiz;
+}
+
+=head2 C<cast>
+
+ cast [$@%&*]var, $wiz, @args
+
+This function associates C<$wiz> magic to the supplied variable, without overwriting any other kind of magic.
+It returns true on success or when C<$wiz> magic is already attached, and croaks on error.
+When C<$wiz> provides a data constructor, it is called just before magic is cast onto the variable, and it receives a reference to the target variable in C<$_[0]> and the content of C<@args> in C<@_[1 .. @args]>.
+Otherwise, C<@args> is ignored.
+
+ # Casts $wiz onto $x, passing (\$x, '1') to the data constructor.
+ my $x;
+ cast $x, $wiz, 1;
+
+The C<var> argument can be an array or hash value.
+Magic for these scalars behaves like for any other, except that it is dispelled when the entry is deleted from the container.
+For example, if you want to call C<POSIX::tzset> 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 handle the possible deletion of the C<'TZ'> entry, you must also specify I<store> magic.
+
+=head2 C<getdata>
+
+ getdata [$@%&*]var, $wiz