in reply to Split STDIN Pipe

Yep-- use open(). Like so:
use File::Copy; open(PROGRAM_OUT, "| $runbin/$program.x") or die "Couldn't open '$runbin/$program.x': $!; stopped"; copy(\*STDIN, PROGRAM_OUT) or die "Couldn't copy: $!; stopped"; close(PROGRAM_OUT) or die "Error while closing: $!/$?; stopped";

Untested.

That runs your FORTRAN process, copying STDIN to it, then checks the error code on file close.

Update: Actually, system() by itself should work fine... it inherits your STDIN from the main program. So if you get rid of the redirection and temporary file, it should work fine. So just

system("$runbin/$program") == 0 or die("'$runbin/$program' failed: returned signal @{[ $? >> 8 ]} +stopped";

stephen

Replies are listed 'Best First'.
Re: Re: Split STDIN Pipe
by Anonymous Monk on Apr 14, 2001 at 07:14 UTC
    I tried the simple system call as you suggested, and although the Fortran program tries to read from STDIN rather than wait for answers it returns an end of file error. Thats why I thought that the fortran knew to read from STDIN, but found nothing in the stream. I think that I will try the pipe method for now.

    Thanks for your help and if anyone has any ideas as to what might be going on, let me know.