in reply to calling external program from CGI
When you point a browser at a CGI script, the script does not run as YOU, but as whatever user the web server is running as - usually 'nobody' or 'www-user' or 'apache'. This frequently causes permission problems, because the 'apache' user (for example) may not be able to read/write files in a particular directory that you can, etc.
So, if you have a script that YOU can run, but that fails to run under CGI, it's probably due to permission problems.
A better solution might be to rewrite your external program so that all the work is contained inside a subroutine, and put this inside a module. Then, your external program can 'use' this module, call the sub, and everything work the same as before, BUT, now the CGI can also 'use' the same module, and call the sub too (no external calls necessary). Since you want to "pass an array" this makes more sense (although if it's going to contain many elements, a REFERENCE to an array will be more efficient than the whole array).
If you're new to perl, I suggest you do a little more reading first - learn about subroutines, modules, references, etc. CGI scripts are hard to get right. There are MANY security issues involved. Read all the FAQs and tutorials on this site, just for starters. Good luck.
|
|---|