Subject: | panic: attempt to copy value Future=... to a freed scalar |
Been seeing variations of this message on 5.16.x for a while, particularly when debugging (and thus, Carp shortmess compexity) is enabled. However, it appears to be possible to trigger it on 5.20.0 even without PERL_FUTURE_DEBUG set.
This seems unfortunate, but perhaps it's fixed in 5.20.2... here's a failing script, maybe I'm doing something wrong here?
cheers,
Tom
Subject: | 2015-02-16-future-panic.t |
use strict;
use warnings;
{
package Don't::Panic;
use Future;
use Future::Utils qw(fmap0);
sub new {
my $class = shift;
bless { pending => [ 3 ] }, $class
}
sub process { Future->done }
sub check_pending {
my ($self) = @_;
$self->{in_check} ||= do {
my $v = (
fmap0 {
$self->process(shift)
} foreach => $self->{pending}
)->on_ready(sub {
delete $self->{in_check}
});
$v
};
}
}
use Test::More tests => 1;
my $thing = Don't::Panic->new;
$thing->check_pending;
done_testing;