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

Re: Why $@ makes me cry (was Re: Generic system() replacements)

Thread Previous | Thread Next
From:
David Nicol
Date:
June 20, 2008 17:23
Subject:
Re: Why $@ makes me cry (was Re: Generic system() replacements)
Message ID:
934f64a20806201723k7778a846v965c605b039b889f@mail.gmail.com
>  Gah, I didn't even think of DESTROY; the following simply prints "Bye from
> Foo":
>
>         sub Foo::DESTROY { print "Bye from Foo\n"; eval {}; }
>
>         eval {
>                 my $x = bless({},"Foo");
>                 die "Oh noes!";
                   1;
         } or      print $@ ;

as does that, but twice.

How hard would it be to defer destruction of lexicals within evals
until the statement containing the eval ends?  What if anything would
that break?

Thread Previous | 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