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

Re: Why $@ makes me cry

Thread Previous | Thread Next
June 25, 2008 18:18
Re: Why $@ makes me cry
Message ID:
>>>>> "Mark" == Mark Mielke <> writes:

Mark> Most people who run eval{} doesn't check for eval{} failing. They check for $@
Mark> being true. Whether $@ is true from eval{} catching an exception, or DESTROY
Mark> doing $@ .=, the resulting $@ is still true.

It's wrong to do $@ .= if you haven't seen whether $@ is an object or not.

But just to put my two cents into this thread, anything that breaks this

        eval {
        if ($@) {
             ... # something went wrong in eval block

is clearly wrong.  And yes, I know a "local $@" inside that block already
breaks this, and I think that's a bug, but I don't know how to fix it

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<> <URL:>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See for Smalltalk and Seaside discussion

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