A Windows 2000 computer running ActivePerl build 631 occasionally
(something like every few weeks, it does thousands of these on most days
with no problem) opens a pipe from another perl script, gets no input
from the pipe, close fails on the filehandle, $! is false, and $?
contains 0x100 * 66 which should mean that perl's exit status was 66.
Windows error 66 is not defined in the errno.h that comes with MSVC 6,
but "net helpmsg 66" prints "The network resource type is not
correct.". I don't know if there's any connection between that error
and the one I'm getting. The perl script, and perl.exe are on local
drives so I don't understand how a network error could result.
I can't see how either perl or my script could return an exit status of
66. perl will return the error code if it can't open the file, but I
can only see how that could be 2 (ENOENT) or 13 (EACCESS). And perl
would print an error message, which would get logged to a file, and that
isn't happening. Likewise, my perl script will always print something
to a log file at startup and before exiting and that isn't happening.
But the logfile is getting written to - that's where I found the error
66 in the first perl script. So I wonder if the error is coming from
somewhere in the implementation of open().
I looked at the pipe code in the sources (in win32/win32.c), and don't
see how anything other than a windows error code or the exit status from
my command could wind up in $?, but I don't know how either of those
could be 66 (and even if perl or my script did exit(66), why an error
message doesn't get read from the pipe).
Has anyone seen this before? And has it been fixed in a later release
of ActivePerl? Or if it's not a bug, what it means? If it happened
daily, I'd just upgrade and see if it stopped, but since the problem
occurs so rarely, it will take a few months before I have even a small
degree of confidence that it helped.
Here is the code. I'm leaving out the details of how the output gets
into a log file.
if ( !open(PIPE, "perl $PATH/faxrpt.pl 2>&1|")) {
die "pipe failed, $!\n";
}
while (<PIPE>) {
print;
}
if ( !close(PIPE)) {
if ($!) {
warn "error closing pipe, $!\n";
} else {
if ($? >= 0x100) {
$s = $? / 0x100;
warn("exit status $s\n");
} else {
warn "signal $?\n";
}
}
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs