develooper Front page | perl.perl5.porters | Postings from June 2016

Re: Confused by eval behavior

Thread Previous | Thread Next
June 23, 2016 16:52
Re: Confused by eval behavior
Message ID:
John Siracusa wrote:
>      Is this expected behavior or a bug?

There is something funny going on there; those cases are not working as
intended.  I suspect that destruction is managing to happen outside the
expected unwinding time, perhaps due to mortal refs.  Note that in test
case 2 the object ref is actually the return value of the eval block,
which might have some bearing, but empirically adding "my $z = $foo;"
or similar as an additional statement inside the eval block changes the
result, even though it's a similar last statement in the block and yields
the same value from the block.  So there's more to this.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About