- or download this
use warnings;
use strict;
...
1;
}
- or download this
foo
Use of uninitialized value in subroutine dereference at script.pl line
+ 30.
...
baz
baz
(in cleanup) Unable to create sub named "" at script.pl line 30.
- or download this
foo
destroying...
baz
baz
- or download this
my $closure_self = $self;
weaken $closure_self;
$self->{sub} = \&One::foo;
*One::foo = sub { $closure_self->{x} = 'x'; return "baz\n"; };
return $self;
- or download this
foo
baz
destroying...
foo
- or download this
sub DESTROY {
use Data::Dump;
...
print dd($self), "\n";
$self->unmock;
}
- or download this
foo
destroying...
...
1
baz
baz
- or download this
foo
baz
...
bless({ sub => sub { ... }, x => "x" }, "Count")
1
foo
- or download this
sub unmock {
my $self = shift;
*One::foo = $self->{sub};
}