Slide 87
Slide 87 text
package Foo;
use strict;
use warnings;
!
use Variable::Magic qw[ wizard cast ];
use Hash::Util::FieldHash qw[ fieldhash ];
!
fieldhash my %foo;
!
my $wiz = wizard(
data => sub { $_[1] },
set => sub { $_[1]->[0]->{ $_[1]->[1] } = $_[0] },
);
!
sub foo {
my $self = shift;
my $foo = $foo{$self};
cast $foo, $wiz, [ \%foo, $self ];
!
$foo = shift if @_;
$foo;
}