KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Calling Perl scripts as a CGI from the 4D Business Kit Web server
PRODUCT: 4D Business Kit | VERSION: | PLATFORM: Mac & Win
Published On: January 3, 2003

Compatibility: Version 1.0 and up

The main purpose of using Perl CGI's with 4DBK is to perform tasks that cannot be done by 4D. Such tasks include updating an external database when an order arrives or inserting a counter to keep track of the number of visitors to your site.

In order to use Perl CGI scripts, you must have a Perl interpreter. If you are on a PC, you can use ActivePerl and if you are on a Mac OS 9.x, you can use MacPerl. Mac OS X comes with Perl built in. Both applications, ActivePerl and MacPerl can be downloaded after a short search on www.google.com.

The CGIs must have a suffix of either ".pl" or ".cgi" to be executed by the Perl interpreter. You can either have the Perl scripts in a folder called cgi-bin at the root level of your 4DBK application (automatically created for you) or they may be placed in the STORE_SITE folder of a store (you will have to create this for yourself). The latter option will keep the scripts isolated for that particular store. Once you have the Perl interpreter installed, you can call the Perl scripts in the cgi-bin folder of the root level by:

<a href="/cgi-bin/your_perl_script.pl">your perl script</a>

You can also call the Perl scripts in the cgi-bin folder at the store level by:

<a href="../cgi-bin/your_perl_script.pl">your perl script</a>