Craig, Thanks for your suggestion. The parent process is indeed in C. But, because the C code executing in the parent is common to both the situations I describe below, namely, the case where perl expects to read a script itself through stdin, and the case where perl runs a script which in turn expects to read data through stdin, I had to go with a common solution. I therefore went with the suggestion given by Ivor of simply checking for the value 26 in the stdin and exiting the loop. ( It's possible that your suggestion of decc$write_eof_to mailbox() might also work in both cases, but since I had a working solution. Thanks, Sam Craig Berry wrote: On Monday, December 06, 2004, at 08:40PM, Sampath Ravindhran <[EMAIL PROTECTED]> wrote:I have an application that spawns a detached process to run a Perl script, within which it expects to read a bunch of lines from STDIN. To do this, I have a simple construct like ----------- while (<STDIN>) { $myline = $_; (process my input line...) } ------------ Before calling the perl script in the detached process, I define sys$input to the mailbox device the parent had created. When the parent process writes text lines into the mailbox, I find that the detached process *does* receive them. After writing the necessary lines, I send an EOF character (decimal 26) to the mailbox expecting it to terminate read from STDIN and proceed further with the execution of the Perl script. However, that doesn't happen and the Perl execution remains in this while loop forever. Closing the channel of the mailbox after the write operation is not a desirable option at this pointIt sounds like what you need is the equivalent of decc$write_eof_to mailbox. See http://h71000.www7.hp.com/doc/732FINAL/5763/5763pro_027.html#decc_write_eof_mbx__sec Since I don't know how that's implemented, I don't know if you could just wrap some XS around it and make it callable from Perl. But it's also not clear to me in your example if the parent process is in Perl or something else. If it's in C, give the above a try and see if it works. I suspect it's just doing a special $QIO to the mailbox channel in a way that bypasses interpretation of the EOF character by the CRTL writes. If the parent is in Perl, you could also try calling VMS::Stdio::binmode on the filehandle before sending the EOF character. I really have no idea whether that will work, but it's something to try. |
- How to terminate STDIN to perl through a mailbox ? Sampath Ravindhran
- Re: How to terminate STDIN to perl through a mailb... IvorW
- Re: How to terminate STDIN to perl through a m... Sampath Ravindhran
- Re: How to terminate STDIN to perl through a mailb... Craig Berry
- Re: How to terminate STDIN to perl through a m... Sampath Ravindhran