FileHandle::DESTROY for fd 0
authorRoderick Schertler <roderick@gate.net>
Wed, 4 Sep 1996 02:55:31 +0000 (02:55 +0000)
committerAndy Dougherty <doughera@lafcol.lafayette.edu>
Wed, 4 Sep 1996 02:55:31 +0000 (02:55 +0000)
This fixes FileHandle::DESTROY when called on stdin.

ext/FileHandle/FileHandle.pm

index 03a698d..1c030ec 100644 (file)
@@ -270,10 +270,10 @@ sub DESTROY {
 
    if ($fh =~ /=FILEHANDLE\(/) {
      local *TMP = $fh;
-     close(TMP) if fileno(TMP);
+     close(TMP) if defined fileno(TMP);
    }
    else {
-     close($fh) if fileno($fh);
+     close($fh) if defined fileno($fh);
    }
 }