Re: [PATCH 17/18] Place the open() call inside the do{} struct and prevent failing close
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 6, 2013, 21:58 UTC
- Message-ID
- <7vbo7iyk8e.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <51B0FF75.9070506@ensimag.fr>
Célestin Matte <celestin.matte@ensimag.fr> writes:
> So using autodie may not be a good idea. > But the problem is that in the current state, open() return values are > checked, but print ones are not, although it should be.
I tried "man autodie" and tried to spot 'print' in the categories list that shows things like ":all covers :default which in turn covers :io which in turn covers read, seek, ..." and didn't see any.
Running the attached as
$ perl ad.perl >&-
gave me "Hi" (i.e. no failure from print) but of course killed a failing syswrite().
So I am not sure your "we must check print" matches well with use of autodie, either.
-- >8 -- #!/usr/bin/perl -w
use warnings; use autodie;
for (my $i = 0; $i < 256; $i++) {
print "Did this die?\n";
}print STDERR "Hi\n";
for (my $i = 0; $i < 256; $i++) {
syswrite(1, "Did this die?\n");
}print STDERR "Lo\n";
exit(0); --- 8< --