Thanks
So you want to include SSI directives in the output from your CGI script, but can't figure out how to do it? The short answer is "you can't." This is potentially a security liability and, more importantly, it can not be cleanly implemented under the current server API. The best workaround is for your script itself to do what the SSIs would be doing. After all, it's generating the rest of the content.
I have had success with the suggestion, which is to have your CGI call the item that was going to be called through SSI. If it is a process on the server, you can use 'system' or backticks to call it. If it is a URL that should be included, you can use LWP or something like that to fetch it.
Apache 2.0 allegedly allows stacked handlers, so you could parse your CGI output for SSI directives. Doesn't help you much now, though.
instead of displaying output to STDOUT, write it to a temporary .shtml file. Then, use LWP::Simple to "get" the file. This will execute the SSI. You can then further process the data in your perl script, etc.
don't know exactly why anybody'd want to do this, but it is possible.
require "UNIX_PATH_TO FILE.cgi"
this will actually run the file where this line is called. However I do not know how t oadd command line arguments. Another note is that it is the UNIX path not the http path. I hope this helps. I could be off on a wild tangent :)
Wow, the ramifications of that are profound. That opens up a whole set of things I've wanted to do before. Auto call other scripts buried in the ssi tmp output...that's cool.
I use the LWP::Simple thing all the time for automatic updating of the CGI script I sell... I had never thought of embedding SSI in the text being read till this thread... It could be useful to me, too.
<added>Oh yeah and I didn't even consider the multi-tasking implications of that!!! ***(light bulbs appearing)***</added>