/usr/share/doc/libvariable-magic-perl/examples
NameSizeModeActions
copy.pl3860755editdlrm
magic.pl6500755editdlrm
synopsis.pl8080755editdlrm
uvar.pl6430755editdlrm
vm_vs_tie.pl9570755editdlrm
Edit: /usr/share/doc/libvariable-magic-perl/examples/copy.pl (386B)
#!/usr/bin/perl use strict; use warnings; use lib qw; use Variable::Magic qw; use Tie::Hash; my $wiz = wizard copy => sub { print STDERR "COPY $_[2] => $_[3]\n" }, free => sub { print STDERR "FREE\n" }; my %h; tie %h, 'Tie::StdHash'; %h = (a => 1, b => 2); cast %h, $wiz; $h{b} = 3; my $x = delete $h{b}; $x == 3 or die 'incorrect';