tags:

views:

26

answers:

1

in the html file:

<!--#exec cgi="/cgi-bin/test.pl"-->

the perl script:

#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "<input type=\"hidden\" name=\"aname\" value=\"avalue\">\n";
print "<img src=\"/cgi-bin/script.pl\" />";

This does not give me an 'error processing directive' error, nor does it output my HTML inplace of the tag. I'll also add that the ssi tag gets replaced with nothing.

A: 

Are you sure the script is executing? If you print something to STDERR does it show up in th error log?

Beyond that I have a few comments:

  1. I'm pretty sure printing the Content-Type is redundant, you (well, Apache anyway) have already done that by serving the HTML file that contains the SSI. reference

  2. exec is really meant for running commands like 'ls -l'. You should use include virtual instead. It also allows you to add arguments to the url. e.g.

    <!--#include virtual="/cgi-bin/example.cgi?argument=value" --\>
    
  3. do yourself a favor and use qq[] instead of the double-quotes. You won't have to escape everything then... e.g.

    print qq[< input type="hidden" name="aname" value="avalue"\b];
    
Matthew Smith
If anyone can explain to ME why the my code blocks aren't working that would be cool too...
Matthew Smith
@Matthew Smith: Need 4 more spaces when you're inside an ordered-list.
geocar
Thanks, geocar!
Matthew Smith
If you don't print headers again, you get premature end of script errors. (atleast on my server), the problem was actually that the 'require' and 'use' statements in the SSI were causing it to fail. (i realize I didnt show those in the perl code, I probably should have)
Yeah, I guess that makes sense. The SSI is actually executing the http request I suppose, so it would need the headers. Glad you figured it out.
Matthew Smith