CGI vs. ColdFusion
We recommend to use ColdFusion rather than CGI for dynamic information creation:
- CGI scripts require starting a new process on the server each time a CGI script is called, this takes time;
- ColdFusion pages run in a controlled environment which allows us to limit the damage an application can do to the other applications that are running on the same server; we therefore accept direct upload of CFM pages in the same way as for static contents;
- the possibilities to limit the scope of CGI scripts (access permissions, functionalities) are rather limited; we therefore do not allow information providers to add or update CGI scripts directly;
- ColdFusion pages are located among the related HTML pages and images, which makes it easier to use relative links;
If this convinced you to use ColdFusion, please refer
to the chapter on using
ColdFusion.
If you insist on using the good old slow CGI, please,
read on.
cgi-bin directory
For reasons of management and security all CGI scripts and programs on the 'home content servers' have to reside in or under the "cgi-bin" sub directory. The "cgi-bin" directory will always be located at the "root" of the web servers (e.g. http://www.cc.cec/cgi-bin/).The cgi-bin directories can only be updated by the web team. Developers will not be allowed to load and/or update scripts and programs without the help of the web team.
New or updated CGI scripts can be verified on our staging platform. This allows developers to make sure the scripts run on the EUROPA/IntraComm platform. Please note that scripts should be developed and tested elsewhere before running a last verification on our staging platform.
For information about running CGI scripts and programs on local servers refer to the corresponding chapter.
Note: for reasons of management and security we only accept to execute scripts/programs which are found in the cgi-bin directory. In other words, scripts and programs cannot reside in other directories than the cgi-bin directory. This excludes the use of the Server Side Include tag "exec", and similar functions (e.g. PHP/FI).
Creating CGI scripts and programs
Before starting on a new CGI script verify if the functions you are looking for haven't already been created by somebody else. The web team can help you.The Perl language is a good choice when programming CGI scripts. We have installed Perl5. The full path name of the Perl program is the path "/opt/local/bin/perl".
Some scripts and programs available for use
mailform
The problem with forms is that they all need their own program or script to handle the fields in the form and perform some sort of action. This can make the creation of simple questionnaire type forms difficult for web information providers. Usually you want to collect submitted forms of this type in a file or send it via email to yourself or to someone else.mailform is a program that enables you to easily create these types of forms by using commands that are embedded inside the form HTML file. It then uses simple variable substitution to deliver the results.
mailform has been developed here at Admin-DI-DC web team. A user guide is available.
You may also use ColdFusion instead of this mailform script. For more information, refer to the chapter on using ColdFusion.
print-friendly page: etal.pl
etal is a program that allows you to create a "print-friendly version" of an html page.
The basic principle of a "print-friendly" page is that it has the same content as the referring page, but the template is optimized to use as much space as possible on the printed page. For example, the navigation menu is not needed on a printed page. The stylesheet may also be different so that black & white printing is possible.
The script has been designed to show hidden html code from the screen version of the page, and to hide html code that is visible in the screen version but that should not be visible on the print version.
More information can be found in the user guide.
CGI.pm
The full CGI Perl module is rather large and its' compilation generates a noticeable performance hit. If you must use this module you can improve performance by only importing those routines you will be using. (If you don't know what I am talking about, read the fancy manual.)
Here are two examples:
- Form with POST action: cgipm-demo-post.htm
- Form with GET action: cgipm-demo-get.htm
Note: these examples show all the environment variables that are available to the CGI scripts.