Change 12600 by jhi@alpha on 2001/10/23 11:47:19
Subject: [PATCH 5.6.1 perldoc] one more touch on File::Temp
From: Mikhail Zabaluev <[EMAIL PROTECTED]>
Date: Tue, 23 Oct 2001 10:40:37 +0400
Message-ID: <[EMAIL PROTECTED]>
(#12406 replaced with this)
Affected files ...
... //depot/perl/utils/perldoc.PL#58 edit
Differences ...
==== //depot/perl/utils/perldoc.PL#58 (text) ====
Index: perl/utils/perldoc.PL
--- perl/utils/perldoc.PL.~1~ Tue Oct 23 06:00:05 2001
+++ perl/utils/perldoc.PL Tue Oct 23 06:00:05 2001
@@ -385,18 +385,6 @@
}
}
-sub cleanup {
- my @files = @_;
- for (@files) {
- next unless defined;
- if ($Is_VMS) {
- 1 while unlink($_); # XXX: expect failure
- } else {
- unlink($_); # or die "Can't unlink $_: $!";
- }
- }
-}
-
my @found;
foreach (@pages) {
if ($podidx && open(PODIDX, $podidx)) {
@@ -585,34 +573,14 @@
}
}
-# until here we could simply exit or die
-# now we create temporary files that we have to clean up
-# namely $tmp, $buffer
-# that's because you did it wrong, should be descriptor based --tchrist
-
-my $tmp;
-my $tmpfd;
-my $buffer;
-
require File::Temp;
-($tmpfd, $tmp) = File::Temp::tempfile();
-
-# make sure cleanup called
-eval q{
- sub END { cleanup($tmp, $buffer) }
- 1;
-} || die;
+my ($tmpfd, $tmp) = File::Temp::tempfile(UNLINK => 1);
-# exit/die in a windows sighandler is dangerous, so let it do the
-# default thing, which is to exit
-eval q{ use sigtrap qw(die INT TERM HUP QUIT) } unless $^O eq 'MSWin32';
-
my $filter;
if (@pod) {
- my $buffd;
- ($buffd, $buffer) = File::Temp::tempfile();
+ my ($buffd, $buffer) = File::Temp::tempfile(UNLINK => 1);
print $buffd "=over 8\n\n";
print $buffd @pod or die "Can't print $buffer: $!";
print $buffd "=back\n";
End of Patch.