in reply to Replacing closures (to work around threads crash)

Instead of doing the eval 99999 times, how about

my $per_thread_closure_maker = eval <<' CLOSURE_HACK'; sub { my ($warns) = @_; return sub { push @$warns, @_ }; }; CLOSURE_HACK for my $j (1..99999) { my @warns; { local $^W = 1; local $SIG{"__WARN__"} = &$per_thread_closure_maker(\@warns); } }