Hi, why don't you use "readpipe", which lets you avoid the intermediate data file:
... my $data = readpipe ($cmd); ... Helmut > > I tried this (inside the handler): > > ... > my $cmd = '/opt/reports/bin/getdata'; > system($cmd, @params); > if ( open(DATA, '/opt/reports/var/data.txt') ) { > local $_; > while (<DATA>) { $r->print($_) } > close DATA; > } else { > $r->print("<h1>Canīt read data</h1>"); > } > ... > > The program getdata put output in /opt/reports/var/data.txt > > I tried also: > > qx{ $cmd @params } > > and > > `$cmd @params` > > but it does not work. > > The problem is that if you check the /opt/reports/var/ directory the > data.txt is generated correctly for each requet. > > Thanks, > Alejandro Galue. > > -----Original Message----- > From: Tom Schindl [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 28, 2004 3:29 PM > To: Alejandro Galue > Cc: [EMAIL PROTECTED] > Subject: Re: Problem with perl system() function > > Hi, > > system will wait until the executed shell-script has finished. I'd rather > guess that you are not allowed to call the commandline programm you'd like > to call. > > Did you get any thing in the error_log? How do you call the > system-command: > > * system > *`` > * qx > > Maybe you could show us the code you're using and we'll tell you whats > wrong there. > > Tom > > Alejandro Galue wrote: >> Hello All, >> >> Iīm using mod_perl2 and Apache2 over Fedora Core 1. >> >> I have a handler that need to call an external program to complete the >> request. >> >> This program put its output to a file, and then I read this output >> from the handler (after system function) to complete the request. >> >> My problem is (I assume) when I call system, it returns inmediatly and >> of course when I try to read the file output, it does not exist; >> becase it was created later. >> >> How can I force to wait for a system function terminate the execution >> of an external program. >> >> Thanks, >> Alejandro Galue. >> >> -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html