From 98d4926fea8eafa1965e66ae8550f334658a2a43 Mon Sep 17 00:00:00 2001 From: Chip Salzenberg Date: Thu, 16 Jan 1997 13:23:20 +1200 Subject: Gut IO::Handle::DESTROY --- ext/IO/lib/IO/Handle.pm | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'ext/IO/lib') diff --git a/ext/IO/lib/IO/Handle.pm b/ext/IO/lib/IO/Handle.pm index e271268390..03118ee55e 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. -- cgit v1.2.1