Notice! This document is currently in Archived status.
The content of this document may be incorrect or outdated.

Print this article Edit this article

Using ECN Wraps with a cgi script

If you have a cgi-script written in PERL you may use the ECN Wraps. To use them add the following to your script:

use lib '/usr/local/etc/httpd/DocumentRoot/ECN/ecnweb'; use ECN::Wrap;

Then where you would normally print the head and foot of the html document, simply call the functions wrap_top and wrap_bottom, respectively.

For Example:

#!/usr/bin/perl -w # example.cgi # This is a program to show how the # ECN Wraps are used with PERL use lib '/usr/local/etc/httpd/DocumentRoot/ECN/ecnweb'; use ECN::Wrap; #print the html header print "Content-type: text/html\n\n"; #Call the wrap_top function to add the ECN header. &wrap_top; #Body of the page goes here! print "<h1>Hello World!</h1>"; print "<a href=\"$ENV{'HTTP_REFERER'}\">Back to the FAQ page.</a>"; #Call the wrap_bottom function to add the ECN footer. &wrap_bottom; exit;

You will also need a .htaccess file with the following lines.

SetEnv WrapTop /ECN/ecnweb/Includes/top.cgi SetEnv WrapBottom /ECN/ecnweb/Includes/bottom.cgi

Here is an example .htaccess file:

Options All MultiViews SetEnv Owner "Purdue University" SetEnv Organization "Engineering Computer Network" SetEnv WrapTop /ECN/ecnweb/Includes/top.cgi SetEnv WrapBottom /ECN/ecnweb/Includes/bottom.cgi SetEnv Home /ECN/ecnweb/ SetEnv DirectoryName "Engineering Computer Network"

To see this example in action click Here

Last Modified: Dec 19, 2016 11:12 am US/Eastern
Created: Jun 21, 2007 12:54 pm GMT-4 by admin
JumpURL: