justuptime.com - monitor your servers & websites

SSI within a CGI script? - Is it possible?

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

He has: 150 posts

Joined: Apr 1999

Is it possible to use the insert and exec SSI commands from within a Perl script?

They have: 15 posts

Joined: Mar 1999

It is not possible to use the include and exec tags in a CGI script but it is possible to emulate what SSI does when a Perl script is executed.

----------
John Slade (ICQ #19533369)
http://www.grandprix1.com - Everything for Microprose F1GP

They have: 4,713 posts

Joined: Jan 1970

You can, actually ....
Instead of printing text/html headers, print wwwserver/html-ssi. That should do the trick (at least in my Win 95 machine)

Cheers,
Federico

----------
UBBdir.com -- Find the internet's best forums
WDresources.com -- Resources for the web developer

They have: 2,397 posts

Joined: Nov 1998

SSI in CGI scripts is not possible to my knowledge Sad
JP

----------
The Webmaster Promotion and Resource Center.
http://www.what-next.com

JP Stones
Perforated Edge - Tearing Through Convention

A UK Based Creative Communications Agency

They have: 220 posts

Joined: May 1999

I use 'Require' to insert a file into a cgi script.

Example:
require "../burst-sub.cgi";

There are two limitations that I have noted:

1) The script MUST return a True or 1 value at the end or it will add an entry to your error logs. (simple to do: $result = 1; as the last line)

2) You can only 'include' this file in any cgi file ONCE... the reason is simple - it has already been included.

I don't know if this is not 'standard'... but I know it works... I use it often.

Matt

----------
1-On-1 Free Basketball Game - Wanna Play?
http://basketball-game.com

1-On-1 Free Basketball Game - Wanna Play?
http://basketball-game.com/
Thousands of Players around the World compete weekly!

They have: 15 posts

Joined: Mar 1999

I use

Include Tag:-

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

Exec tag:-

$ssiexec = `file.cgi` ;
$ssiexec =~ s!Content-type: \w+/\w+!!i ;
print "$ssiexec" ;

----------
John Slade (ICQ #19533369)
http://www.grandprix1.com - Everything for Microprose F1GP

They have: 220 posts

Joined: May 1999

The line I listed above is what I use to include existing cgi scripts (like my banner rotator) that I want to 'insert' into a secondary script (like my message board). That way I don't have to cut and paste the code into that spot... and if I change the original code, it automatically changes in the second script.

Matt

----------
1-On-1 Free Basketball Game - Wanna Play?
http://basketball-game.com

1-On-1 Free Basketball Game - Wanna Play?
http://basketball-game.com/
Thousands of Players around the World compete weekly!