PDA

View Full Version : SSI in CGI



sagethefreak
October 27th, 2001, 10:31
is it possible to include SSI in a CGI page?
what i want to do is include the header.txt in the cgi ouput.. is it possible?

Dusty
October 27th, 2001, 10:58
Why would you need SSI to do that? Just open the file and print it out within the script:

open(FILE,"<header.txt");
while(<FILE>){
print $_;
}
close(FILE);

LastActionHero
October 27th, 2001, 11:10
I think hayama mentioned some function like getprint()

Dusty
October 27th, 2001, 11:14
That's an LWP function, it does the exact same thing as "get" except instead of dropping it into a variable it's prints it out.

But really, the file's locally hosted, there's no need to bog down the script with LWP (which is used mainly to retrieve remote files). Just open it and print it out.

sagethefreak
October 27th, 2001, 11:39
Originally posted by Dusty
Why would you need SSI to do that? Just open the file and print it out within the script:

open(FILE,"<header.txt");
while(<FILE>){
print $_;
}
close(FILE);

thanks, i dont really know CGI, thats why i couldnt figure it out. :P

niv
October 27th, 2001, 15:50
(It's Perl, not CGI. CGI can take many forms. Anyway,...)

In the future, if you're calling a script like a Perl script, you may want to specify variables beforehand and make the script that is being called a subroutine or just get rid of the #!/usr/bin/perl line at the top of it, and add a 1 at the end of it.