perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alejandro Galue" <>
Subject RE: Problem with perl system() function
Date Wed, 28 Apr 2004 19:55:23 GMT

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 }


`$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.

Alejandro Galue.

-----Original Message-----
From: Tom Schindl [] 
Sent: Wednesday, April 28, 2004 3:29 PM
To: Alejandro Galue
Subject: Re: Problem with perl system() function


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


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:
Mail list info:
List etiquette:

View raw message