I would like to use a bash file as my config file for a project, so that the same config file can be used for all scripts regardless of language (especially bash and perl).
This is no problem from command line
$ source configfile.sh
$ ./perlscript.pl
But in a cgi script the answer's not so clear.
One way is using bash cgi file to execute a perl script.
#!/usr/bin/env bash
# mycgiscript.cgi
source /path/to/configfile.sh
perl /path/to/perlscript.pl
# i think the print functions in perlscript just output to the browser?
But if I do that, then bash is handling all of the http parameter parsing, and any of perl's cgi capabilities and modules become useless unless I am mistaken. Since perl would be doing all the leg work anyway, it seems using the cgi for parameter passing should be natural, but maybe there's no real problem with having bash manage the http request?
Another way is to use a Perl CGI file to parse the config file, and set the environment variables based on the parsing. The variables in configfile.sh reference each other though, causing complicated parsing and headaches.
So, what is the best practice for using a bash config file to set project-specific config/environment variables used by output generating Perl code, within a cgi script?
VAR=HARDCODED_VALUEstatements? Or wouldVAR=$VAL1/VALPART2still qualify? - hilcharge