tags:

views:

76

answers:

2

Hi I am trying to include a perl script within my shtml file. Unfortunately when I do my script doesnt seem to run but instead it just displays the content of the script.

The code I am using is as follows:

test.shtml:

<html>
<title> business home page </title>
<body>
</br>
<!--#echo var="DATE_LOCAL" --> 
<br />
<!--#include virtual="hello.pl"-->
</body>
</html>

hello.pl:

#!C:/Sun/WebServer6.1/bin/https/perl/perl

print "Content-type:text/html\n\n";

print "Hello World!"; 

I am not sure what I am doing wrong. Incase you all wanted to know the server I am using is Sun One WebServer 6.1 (OS = Windows XP). Thanks for your responses!

+2  A: 

The de facto standard SSI directive for executing dynamic content within an SSI page is

<!--#exec cgi="hello.pl"-->

That works with Apache mod_include and at least a few other web servers that support SSI. No idea if it will work on your platform, but give it a shot.

friedo
i've given that a try seems to be giving me an error occured while processing this directive/
Bilzac
+1  A: 

Try getting rid of the first print statement in your Perl program, which sets the content-type header. That's not a useful thing to do in the body of an HTML page, which is where your SSI is located.

SSI is a rather quaint technology these days, even if it is occasionally useful, so if you are serious about learning web programming then this is not an area where you should spend much time.

virtualsue
Hey thanks for you response. No I am actually not learning this at all. It sort of like the tools I am givin to work with, so I have to try and make hte best of them. Dont have a choice.
Bilzac