develooper Front page | perl.perl5.porters | Postings from November 1999

Re: Unlink Failure in t/parsefile.t

From:
Gisle Aas
Date:
November 11, 1999 06:04
Subject:
Re: Unlink Failure in t/parsefile.t
Message ID:
m3u2mtktui.fsf@eik.g.aas.no
The following program fails with perl5.005_03 on Win32-systems because
the file handle will not be closed before unlink() is called.  I have
verified that the close(2) call also is missing on Linux (with strace).
In perl5.005_62 I don't see this problem.  What patch did fix this?

Are there any plans for a 5.005_04?

Regards,
Gisle


#!/usr/bin/perl
print "1..1\n";

my $file = "foo$$.bar";

use Symbol qw(gensym);

my $f = gensym();

open($f, ">$file") || die "Can't create $file: $!";
foo(*$f);   # calling it as foo($f) is ok
undef($f);

unless (unlink($file)) {
    warn "Can't unlink $file: $!";
    print "not ";
}

print "ok 1\n";

sub foo {
    my $x = shift;
    print $x "Foo\n";
}




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About