in reply to Running multiple CGI programs

Ok, I better explain exactly what I'm doing. I have a template-based website maintenance system. It stores the contents of a web page in text files, which allows the user to update a text file and click a generate button to make it into a web page. The system is a bit more complex than that, but that describes the function in a nutshell. The problem comes in when the text file that holds the menu is changed. The user would then have to click the generate button on each page. What I want to do is make a script that could run all of the scripts so the user didn't have to do that. The script would simply have to call each CGI script like this:

perl update.cgi?action=generate

to cause the scripts to generate the pages. Speed isn't so much of a problem because very few people would be updating the site. I hope that clarifies some things. If there are other issues I should clarify, please just let me know. Thanks!

Replies are listed 'Best First'.
Re: Re: Running multiple CGI programs
by perrin (Chancellor) on Sep 17, 2001 at 18:48 UTC
    Thanks for the further explanation. It sounds like you have a problem with mixing interface and implementation. One of my preferred ways to design CGI programs is to have a module that implements the actual functionality and then a CGI front-end that calls that module. If you write your code this way, it's trivial to write a command-line front-end for the module when you need it or to simply call it from another module.

    If you can't deal with that right now and you want a quick and dirty solution, the simplest approach is to use LWP to make additional calls to the server and run the other CGIs. You could simulate a CGI environment by setting environment variables and executing the other programs, but if speed is not an issue there's no reason to do the additional work.