From: Chip Salzenberg Date: Thu, 16 Jan 1997 01:23:20 +0000 (+1200) Subject: Gut IO::Handle::DESTROY X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=98d4926fea8eafa1965e66ae8550f334658a2a43;p=p5sagit%2Fp5-mst-13.2.git Gut IO::Handle::DESTROY --- diff --git a/ext/IO/lib/IO/Handle.pm b/ext/IO/lib/IO/Handle.pm index e271268..03118ee 100644 --- a/ext/IO/lib/IO/Handle.pm +++ b/ext/IO/lib/IO/Handle.pm @@ -192,7 +192,7 @@ use SelectSaver; require Exporter; @ISA = qw(Exporter); -$VERSION = "1.1401"; +$VERSION = "1.1402"; @EXPORT_OK = qw( autoflush @@ -269,24 +269,14 @@ sub new_from_fd { bless $fh, $class; } -sub DESTROY { - my ($fh) = @_; +# +# There is no need for DESTROY to do anything, because when the +# last reference to an IO object is gone, Perl automatically +# closes its associated files (if any). However, to avoid any +# attempts to autoload DESTROY, we here define it to do nothing. +# +sub DESTROY {} - # During global object destruction, this function may be called - # on FILEHANDLEs as well as on the GLOBs that contains them. - # Thus the following trickery. If only the CORE file operators - # could deal with FILEHANDLEs, it wouldn't be necessary... - - if ($fh =~ /=FILEHANDLE\(/) { - local *TMP = $fh; - close(TMP) - if defined fileno(TMP); - } - else { - close($fh) - if defined fileno($fh); - } -} ################################################ ## Open and close.