summaryrefslogtreecommitdiff
path: root/ext/IO/lib
diff options
context:
space:
mode:
authorChip Salzenberg <chip@atlantic.net>1997-01-16 13:23:20 +1200
committerChip Salzenberg <chip@atlantic.net>1997-01-17 08:39:00 +1200
commit98d4926fea8eafa1965e66ae8550f334658a2a43 (patch)
tree5db054fddacf44be65626720698bff9d8a979016 /ext/IO/lib
parent17b893d84b57c51991c9e5a231e89e0674ae51c9 (diff)
downloadperl-98d4926fea8eafa1965e66ae8550f334658a2a43.tar.gz
Gut IO::Handle::DESTROY
Diffstat (limited to 'ext/IO/lib')
-rw-r--r--ext/IO/lib/IO/Handle.pm26
1 files changed, 8 insertions, 18 deletions
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.