Subject: | Cycle references |
In Type::Tiny and Type::Coercion classes there is private attribute called _overload_coderef, with coderef that refers to "$self", but that coderef is stored in $self which results in reference cycle.
Can be tested with perl -e 'use Types::Standard qw/Bool/; use Devel::Cycle; find_cycle(Bool)'
Suggested solition (line 156 Type::Tiny, line 44 Type::Coercion):
my $self_weak = weaken($self);
$self->{_overload_coderef} ||= sub { $self_weak->assert_return(@_) };