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

Re: local $@ has an unwanted side effect

Thread Previous | Thread Next
From:
Mark Mielke
Date:
March 21, 2008 15:37
Subject:
Re: local $@ has an unwanted side effect
Message ID:
47E438BB.7080705@mark.mielke.cc
David Nicol wrote:
> On Fri, Mar 21, 2008 at 12:59 PM, Mark Mielke <mark@mark.mielke.cc> wrote:
>   
>>  seem to be something that absolutely must change), I believe the true
>>  problem here is that die seems to be pass by reference, and that local
>>  is restoring the value to undef (or whatever it was before) before $@ is
>>  made available to the caller.
>>     
>
> no that's not it but it is a red herring -- I would like to revise the proposed
> addition of this issue to the eval documentation to but double-quotes
> around the $@ in the commented-out line in the example code.
>
>
>   

That's not a real solution - what about if $@ is an object?

Effectively you are changing pass by reference to pass by string copy - 
which is good for probably 95%+ cases. As I said, the problem is pass by 
reference.

Cheers,
mark

-- 
Mark Mielke <mark@mielke.cc>


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