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

AW: IO::Dir destructor

Thread Previous | Thread Next
From:
Dintelmann, Peter
Date:
June 2, 2008 05:49
Subject:
AW: IO::Dir destructor
Message ID:
3852726AFA94DE4F87E616F13F416A5F0216D9BE@naimucu1.ffz00k.rootdom.net

> -----Urspr√ľngliche Nachricht-----
> Von: Rafael Garcia-Suarez [mailto:rgarciasuarez@gmail.com]
> Gesendet: Sonntag, 1. Juni 2008 21:49
> An: Zefram
> Cc: perl5-porters@perl.org
> Betreff: Re: IO::Dir destructor
> 
> 
> 2007/9/8 Zefram <zefram@fysh.org>:
> > The IO::Dir destructor can clobber $! and other status variables.
> > This is a bad thing to do implicitly upon exiting a block.  
> Attached patch
> > fixes it.
> 
> Thanks, applied as #33983.


The same seems to happen in DirHandle.pm. Following the lines
of Zefram:

--- perl-current/lib/DirHandle.pm       2006-06-13 21:29:13.000000000 +0200
+++ DirHandle.pm        2008-06-02 14:46:27.000000000 +0200
@@ -60,6 +60,7 @@
     my ($dh) = @_;
     # Don't warn about already being closed as it may have been closed 
     # correctly, or maybe never opened at all.
+    local($., $@, $!, $^E, $?);
     no warnings 'io';
     closedir($dh);
 }

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