On 13 Jun 2009, at 17:50, Vincent Pit wrote:
>> it seems that $state is DESTROYed /before/ $foo - which surprises
>> me a
>> little. And, as I said, it doesn't seem to help if I wrap the closure
>> call in nested blocks or even an additional layer of sub call.
> I think $foo is destroyed when $block's pad is freed, which happens
> when
> $block goes out of scope.
Ah! That might help, thanks.
>
>> From your code, I'd expect it to happen after $state is destroyed.
> Try to move the $state declaration before the block one. Another
> idea is
> to store a reference to $state inside the block you call :
>
> my $rc = sub { my $dummy = $state; goto &$block }->();
So might that :)
--
Andy Armstrong, Hexten
Thread Previous