[OT] Re: mod_perl, pipes, and "No child processes"
On Tue, 6 Nov 2001, Tom Servo wrote: > On Tue, 6 Nov 2001, Luciano Miguel Ferreira Rocha wrote: > > > > > > > I was under the assumption that doing something similar to: > > > > > > my $returnval = $msg->send(); > > > > > > Would give a similar answer. > > > > > > I'll give the $? a shot though. I've noticed that from the shell, it > > > always has a 0, and that would show up as false under perl... > > > > Well, on the shell and every other program, an exit status of 0 means > > success, and a higher one means an error of some kind. > > > > Btw: /bin/false ; echo $? ==> 1 > > /bin/true ; echo $? ==> 0 > > > > Also, the SIGCHLD is sent when a child exits, no matter if in error. > > You should then check the $? for the reason of the exit and for the > > return code, if exited normally. > > > > Regards, > > Luciano Rocha > > > > I've done this now and am getting back a -1 in $?, despite the mail itself > succeeding. How can I check the reason for an error code on $? ? Check the Camel book p134 "Global Special Variables" (2nd ed). Regards, Jie
Re: mod_perl, pipes, and "No child processes"
On Tue, 6 Nov 2001, Luciano Miguel Ferreira Rocha wrote: > > > > I was under the assumption that doing something similar to: > > > > my $returnval = $msg->send(); > > > > Would give a similar answer. > > > > I'll give the $? a shot though. I've noticed that from the shell, it > > always has a 0, and that would show up as false under perl... > > Well, on the shell and every other program, an exit status of 0 means > success, and a higher one means an error of some kind. > > Btw: /bin/false ; echo $? ==> 1 > /bin/true ; echo $? ==> 0 > > Also, the SIGCHLD is sent when a child exits, no matter if in error. > You should then check the $? for the reason of the exit and for the > return code, if exited normally. > > Regards, > Luciano Rocha > I've done this now and am getting back a -1 in $?, despite the mail itself succeeding. How can I check the reason for an error code on $? ?
Re: mod_perl, pipes, and "No child processes"
> > I was under the assumption that doing something similar to: > > my $returnval = $msg->send(); > > Would give a similar answer. > > I'll give the $? a shot though. I've noticed that from the shell, it > always has a 0, and that would show up as false under perl... Well, on the shell and every other program, an exit status of 0 means success, and a higher one means an error of some kind. Btw: /bin/false ; echo $? ==> 1 /bin/true ; echo $? ==> 0 Also, the SIGCHLD is sent when a child exits, no matter if in error. You should then check the $? for the reason of the exit and for the return code, if exited normally. Regards, Luciano Rocha -- Luciano Rocha, [EMAIL PROTECTED] The trouble with computers is that they do what you tell them, not what you want. -- D. Cohen
Re: mod_perl, pipes, and "No child processes"
> > > Any ideas what is causing this? Like I said, the mail goes out > fine, but > it makes it pretty difficult to check the return code since > it's always > coming back false. > > Shouldn't you check $? instead? > I was under the assumption that doing something similar to: my $returnval = $msg->send(); Would give a similar answer. I'll give the $? a shot though. I've noticed that from the shell, it always has a 0, and that would show up as false under perl...
Re: mod_perl, pipes, and "No child processes"
On Tue, 6 Nov 2001, Tom Servo wrote: > Hello all. I'm writing an app that opens a pipe to sendmail, which if > memory serves, forks off a child process of apache to do the pipe, then > exits as soon as it's finished. > > I was doing this with MIME::Lite, and it's been working absolutely > splendidly on Linux and on Solaris 7. However, on Solaris 8 (and I don't > know if this is related to the OS or not) it gives me all sorts of > problems. Namely, this started after checking the return code on a > MIME::Lite object called $msg after calling the send method. It usually > returns a 1 on success, but on the new box it was returning 0, despite the > fact that the e-mails were actually going out. > > I ended up writing a test on that just opens a filehandle to | > /usr/lib/sendmail -t -ei -eom, then printing to the filehandle, and > closing the filehandle. If memory serves, it's almost impossible to get > something accurate out of this statement in mod_perl: > > open(SENDMAIL, "| /usr/lib/sendmail -t -ei -eom") or do_something(); > As that just reports on whether or not an apache child process was able to > spawn, not whether it was actually able to open the pipe to sendmail. > > So, that runs fine, then the print works as I actually get the e-mails > it's trying to send, but this bit of code: > > close(SENDMAIL) or print STDERR "Filehandle close failed: $!"; > > spits out: "Filehandle close failed: No child processes" > > Any ideas what is causing this? Like I said, the mail goes out fine, but > it makes it pretty difficult to check the return code since it's always > coming back false. Shouldn't you check $? instead? Jie