From: Mikhail Zabaluev Date: Tue, 23 Oct 2001 10:40:37 +0000 (+0400) Subject: one more touch on File::Temp X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=008d9c33675aa00e42b5f6fb7c669165487b9dc5;p=p5sagit%2Fp5-mst-13.2.git one more touch on File::Temp Message-ID: <20011023104037.A12761@localhost.localdomain> (#12406 replaced with this) p4raw-id: //depot/perl@12600 --- diff --git a/utils/perldoc.PL b/utils/perldoc.PL index 7f8216a..1d64faf 100644 --- a/utils/perldoc.PL +++ b/utils/perldoc.PL @@ -385,18 +385,6 @@ sub page { } } -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 @@ EOD } } -# 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; - -# 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 ($tmpfd, $tmp) = File::Temp::tempfile(UNLINK => 1); 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";