dcs0ock
asked on
Perl's problem with running an external program
Dear Perl experts,
I am trying to execute an external program through a perl script. This script creates a file, updates a file, and creates an HTML page on the fly. The script then needs to run a program called 'waisindex' to create several files. Waisindex works ok if it is run from the Unix command line. A file permission of 'sum_$id_value[1].txt' is 644, but other's permissions are 755. The related part of the script is as follows:
--------
.
.
.
`/home/dcs0ock/bin/waisind ex -t fields -d /home/dcs0ock/wsdb/sear -a /home/dcs0ock/public_html/ terra/summ ary/sum_$i d_value[1] .txt`;
--------------
I am trying to execute an external program through a perl script. This script creates a file, updates a file, and creates an HTML page on the fly. The script then needs to run a program called 'waisindex' to create several files. Waisindex works ok if it is run from the Unix command line. A file permission of 'sum_$id_value[1].txt' is 644, but other's permissions are 755. The related part of the script is as follows:
--------
.
.
.
`/home/dcs0ock/bin/waisind
--------------
ASKER
The actual error of the perl script is that a part related to
'waisindex' of a perl script would not be run. The script has
been used as a CGI script without any problem and I've added the part of 'waisindex' to the script. The other parts of the script except a 'waisindex' part shown in the above question are normally run ok. Thus, it seems to me that this problem is not
concerned with a different user name or different 'home' directory. Have you got any clue?
Thank a lot.
'waisindex' of a perl script would not be run. The script has
been used as a CGI script without any problem and I've added the part of 'waisindex' to the script. The other parts of the script except a 'waisindex' part shown in the above question are normally run ok. Thus, it seems to me that this problem is not
concerned with a different user name or different 'home' directory. Have you got any clue?
Thank a lot.
Try putting the waisindex command inside a system call instead of using backticks.
ex:
system("/directory/waisind ex options");
ex:
system("/directory/waisind
ASKER
Edited text of question
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You don't say what the actual error reported is.
Remember that as a user accessing the script through a web browser you will have a different user name (something like 'nobody'). Presumably you will have a different 'home' directory as a consequence. Could this be your problem?