sub mock { my $self = shift; # ref count ++ return sub { $self->{Thing}; }; # $self is still held by the sub, so it is not freed }