]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - samples/uvar.pl
6620aec4f8952bb9213980796a768c25ba7aa6ea
[perl/modules/Variable-Magic.git] / samples / uvar.pl
1 #!/usr/bin/env perl
2
3 use lib qw{blib/arch blib/lib};
4
5 use strict;
6 use warnings;
7
8 use Variable::Magic qw/wizard cast/;
9
10 my $w = wizard map {
11  my $s = $_; $s => sub { print STDERR "$s $_[2]!\n" }
12 } qw/fetch store exists delete/;
13 my %h;
14 cast %h, $w;
15 $h{'foo'} = 1;
16 print STDERR "#", $h{'foo'}, "#\n";
17 my $y = exists $h{'foo'};
18 delete $h{'foo'};