- or download this
sub mock {
my $thing = shift;
...
*One::foo = sub { $closure_self->{x} = 'x'; return "baz\n"; };
return $self;
}
- or download this
foo
baz
destroying...
foo
- or download this
print One::foo();
{
...
print One::foo();
}
print One::foo();
- or download this
foo
Use of uninitialized value in subroutine dereference at script.pl line
+ 31.
...
baz
baz
(in cleanup) Unable to create sub named "" at script.pl line 31.