Closed p5pRT closed 20 years ago
This program runs /bin/false\, a standard unix command\, on a piped open\, then closes the filehandle. /bin/false is the program which exits immediately with exit status 1. According to the manual:
If the file handle came from a piped open C\<close()> will additionally return FALSE if one of the other system calls involved fails or if the program exits with non-zero status. (If the only problem was that the program exited non-zero C\<$!> will be set to C\<0>.)
[perlfunc/close]
Since /bin/false exited with non-zero status\, $! should be set to 0. However\, it is instead set to the empty string.
#!/usr/bin/perl
open FH\, "/bin/false |" or die "fork: $!";
print ">> $_" while \
The output is:
close rc: (); $!: (); $?: (256)
If there is any version of Perl that has ever set $! to 0\, I cannot find it. Versions up through 5.003 set $! to `Illegal seek' (which I guess is probably system-dependent) and versions 5.004 and later show the behavior above.
mjd@plover.com writes:
Since /bin/false exited with non-zero status\, $! should be set to 0. However\, it is instead set to the empty string.
Do you remember that $! is double-headed? It has both numeric and string values...
Ilya
mjd@plover.com writes:
Since /bin/false exited with non-zero status\, $! should be set to 0. However\, it is instead set to the empty string.
Do you remember that $! is double-headed? It has both numeric and string values...
Maybe the documentation is at fault\, then. I don't see why the current behavior is not simply described by
If the only problem was that the program exited non-zero $! will be set to the empty string.
On Mon\, Feb 07\, 2000 at 04:19:54PM -0500\, Mark-Jason Dominus wrote:
Do you remember that $! is double-headed? It has both numeric and string values...
Maybe the documentation is at fault\, then. I don't see why the current behavior is not simply described by
If the only problem was that the program exited non\-zero $\! will be set to the empty string\.
Because the value of $! *is not a string*.
Ilya
Because the value of $! *is not a string*.
If it were a string\, how would the behvaior be different in this case?
Maybe the documentation is at fault\, then. I don't see why the current behavior is not simply described by
If the only problem was that the program exited non\-zero $\! will be set to the empty string\.
Because the value of $! *is not a string*.
Wrong. Back into the Sophist's hole with you. Just looking for crap to pick at today\, eh?
It can be a string. It can be also a number.
And these are magically rather than canonically connected.
So what.
--tom
Migrated from rt.perl.org#2113 (status was 'resolved')
Searchable as RT2113$