develooper Front page | perl.perl5.porters | Postings from September 2010

Localizing $@ difference between 5.12.2 and 5.13.5 (Was: problem with load.pm)

Thread Next
From:
Elizabeth Mattijsen
Date:
September 20, 2010 06:18
Subject:
Localizing $@ difference between 5.12.2 and 5.13.5 (Was: problem with load.pm)
Message ID:
19548D6B-2A4B-4AA7-A903-10AD25166329@dijkmat.nl
Seems that between 5.12.2 and 5.13.5, a subtle difference has started in the handling of local $@.

Take the following code in Bar.pm:

=========================================
package Bar;
sub import { local $@; die "import failed" }
1;
=========================================

in perl 5.12.2, this does *not* fail:

$ perl5.12.2 -I. -MBar -e1
$ 

in 5.13.5 it does:

$ perl5.13.5 -I. -MBar -e1
import failed at Bar.pm line 3.
BEGIN failed--compilation aborted.
$

I'm not actually sure whether the new behaviour is the correct one or not.  It feels more correct to me, as localizing $@ should not have the same effect as surrounding a scope with an eval.  Or should it?


In any case, this is the reason that load.pm is failing in bleed.  I'll be committing a fix to load.pm soon.


Liz
Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About