Hosting Services > Developer's Corner > CGI

CGI Frequently Asked Questions

 

What is the location of the perl executable?

Perl is located at:

#!/usr/bin/perl

What is a META Refresh Tag?

You can find more about the meta refresh tag at http://www.htmlhelp.com/reference/html40/head/meta.html.

What is the preferred method for generating a random number?

Use Perl's rand function. If you haven't called srand yourself, Perl calls srand with a "good" seed the first time you call rand.

Why is Perl complaining about a "Literal @ now requires backslash"?

The '@' character, found in email addresses, is an array symbol in Perl. If Perl is complaining about a stray '@', you most likely need to "backslash" it, by entering '\@' instead of '@'.

 

Where is perl located?

Perl is found at /usr/bin/perl. Perl scripts should begin with the following line:

#!/usr/bin/perl

This is Perl 5.005.02. When developing on your local system, run perl -v to verify that you are using the correct Perl version.

What Perl modules are installed?

Our list of installed Perl modules is updated periodically. Please visit the Developer’s Corner of your account to view.

What is the location of the sendmail executable?

Sendmail is located at:

/usr/sbin/sendmail

You must use the "-t" option when using sendmail. The following code snippet illustrates the use of the proper invocation:

$to = "you\@yourname.com";
$from = "them\@theirname.com";
$subject = "My message subject";

open MAIL, "|/usr/sbin/sendmail -t";
print MAIL "To: $to_addr\n";
print MAIL "From: $from_addr\n";
print MAIL "Subject: $subject\n";
print MAIL "\n";
print MAIL "$message_body\n";
close MAIL;
 

Where do I place my CGI scripts?

CGI scripts should be placed in the /cgi-bin directory within your document root.

 

What script languages are supported?

We provide the ability to run custom CGI scripts written in many interpreted languages, the most common of which is Perl 5. Compiled C is also permitted.

Our Perl is version 5.008006. Our compiler is gcc 2.95.4 20020320 [FreeBSD].

We strongly recommend that scripts be written in Perl 5. Perl is the widely-accepted standard for CGI development, and is our language of choice. Scripts written in other interpretive languages (i.e. sh, tcl) may function correctly, but their use is discouraged.

 

Where is my /cgi-t directory?

The /cgi-t directory is a hidden directory which houses our freeCGI scripts. These scripts are pre-installed, and use web-based administration instead of actual script manipulation. Accounts are welcome to use both custom CGI and freeCGI scripts.

 

What is the URL to my CGI scripts?

You'll access your CGI using the URL:
http://www.yourname.com/cgi-bin/scriptname.pl

 

What is the URL that corresponds to my /cgi-bin directory?

Your scripts will appear in your /cgi-bin directory. For example: http://www.yourname.com/cgi-bin/scriptname.pl

To access your CGI scripts through the secure server, use URLs of the form:
https://www.keysecure.com/yourname.com/cgi-bin/scriptname.pl
(where
XX is your server number, i.e. www08).

 

What is a CGI-BIN? How do I know if I need one or not?

A CGI-BIN allows you to generate dynamic html with a programming language, i.e. Perl, C++, etc. Essentially it lets you do your own programming and apply that to your website.

If you don't know what one is, or know how to use programming languages, then you probably don't need one. It is typically used only by advanced web developers. If you have more questions about it, please feel free to contact our
customer support.