in reply to system() not waiting
system() forks a child to run the program via an exec and is supposed to wait for the child to finish. Assuming what you say is actually the problem (not the typo noted above):
I would suspect that the redirection to $temp$file is the problem with the system call returning while the shell is doing the write producing a race condition which perl is winning. Have you tried adding a say sleep 1; after the first system call to see if this fixes the problem?
To ensure that the first call has finished you could call it with backticks and capture the output. Then use perl to write $temp$file.
$data = `/3rdparty/perl/bin/sunos5/lwp-request -p http://proxy-syr.glo +bal.lmco.com $hostname$url -C $user:$password`; open F, ">$temp$file" or die "Can't write $temp$file, $1\n"; print F $data; close F; # you don't need the system call to do chmod as Perl has one chmod 777, $tempfile or die "Can't chmod $temp$file $!\n"; system("acroread -toPostScript $temp$file"); system("lp -d ep5_hpp01 $temp *.ps");
If none of that works you could resort to implementing the whole thing in pure Perl.
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Wait
by bluto (Curate) on Oct 03, 2001 at 20:18 UTC |