The main.pl file has many variables, say, main.pl?var1=a&var2=b. I have created a .htaccess to make it SE freindly, in this format, main_a_b.html and I always call the CGI file in this HTML URL format
Now, I want to include a cgi (new.cgi) file in the main.pl. First, I add this line to my htaccess
AddHandler server-parsed .html Then, I add:
print qq~
<!--#exec cgi="new.cgi" -->
~;
to main.cgi. But it does not work. So I add
<!--#exec cgi="new.cgi" --> to header.html, it works. But when I call header.html in main.cgi (through main_a_b.html) , the SSI does not work.
open HEADER, "header.html";
print <HEADER>;
9.How can I have my script output parsed?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.
This is a feature The Apache Group hopes to add in the next major release after 1.3.
[webmasterworld.com ]
[webmasterworld.com ]
Both provide solutions. :)
use LWP::Simple;
$html = get 'http://www.yourdomain.com/main.html';
print $html;
The downside of this is that it causes extra load for your webserver because it has to make a call for the main.html file through http. The upside is that the server side include in the main.html will be executed :)