 |
CGI and PERL Guide net10's customer support never stops. If you do not find the answer to your
questions please call us at (800) 338-6192 or e-mail us support@net10.net.
CGI Utilities :Please
read the notes below before trying to use any of these utilities.
To Start
The following list shows the necessary steps to getting your perl scripts to run on
our server. Keep in mind that just because you have a script that was designed for a NT
server, it still may need to be modified to run on this server. This is especially true if
you are using a script that was originally designed for a unix system.
1. Go into your home directory and make sure that you have a cgi-bin. It should
automatically be there when you first get the account. If it is missing, create your own
directory and name it "cgi-bin"
2. Once you have decided to actually install a cgi script, you must notify the support@net10.net that
you have a cgi-directory to activate. On the subject line include "cgi
activation".
3. When you receive a return e-mail from the webmaster that your directory is cgi
activated you are ready to go. If you have a script that has already been written for you
and is designed for an NT server you should be able to load the script over into your
cgi-bin and go from there. Make sure that if it is a perl script that it ends in a .pl.
For example, if the name of the script is "first", it would be loaded into your
cgi-bin directory as ""first.pl". Only Purl scripts can be uploaded to
cgi-bin directories at this time without prior approval. The policy regarding any
unauthorized scripts or executables is "shoot first, ask questions later". That
is, any *.bat or *.exe files in cgi-bin directories will be deleted if they have not been
pre-approved. Then we'll ask you what they did. Also make sure that you only use scripts
that you have received from a reliable source and which you know exactly what they will
do.
4. Refer to your scripts using a full URL. For example, if your user name is
""montypython",", you might use the tag modifier
""ACTION=http://net10.net/montypython/cgi-bin/script.pl".". You can
actually leave out the ""http://net10.net",", but you have tinkled
your username: "ACTION=/montypython/cgi-bin/script.pl". Top-level domains are
only a little different. The username used to access the site is what is needed before
"/cgi-bin". That is, if your domain is www.mydom.com, and you ftp in with the
username mydom, you would refer to scripts in the cgi-bin directory with
http://www.mydom.com/mydom/cgi-bin/script.pl". If you ftp in with the username
"alphonse",however, the url for "script.pl" would be
"http://www.mydom.com/alphonse/cgi-bin/script.pl". Generally the ftp user id is
the same as the domain name (e.g., mydom.com and mydom), but sometimes there are minor
differences that you need to be aware of: Any Perl scripts should end in the .pl suffix.
The standard: print "Content-type: text/html\n\n"; should be preceded with:
print "HTTP/1.0 200 OK\n"; 5. This should cover most of what you need to know to
get going. Here are a couple of other odds and ends that may help you along.
Programming Notes:
The Web server is a Pentium running NT Server and Microsoft's Internet Information
Server. Perl on this platform is relatively new and not every example program that you
find will run or work exactly as expected. We will be adding NT-specific notes here from
time to time to help you plug some of those holes.
If you are using a perl program that handles forms and you need a mail program such as
send mail on unix systems, we have one. It is called windmail and it handles many of the
same functions as send mail does for unix. Unlike unix systems though you do not have to
specify the exact path to the program.
For example, on a unix system the perl script to send mail would look something like this:
open(MAIL, "| /usr/local/sendmail -t) || die "I can't open sendmail\n";
print MAIL "To: My Name \n";
print MAIL "From: Guestbook@myhost.com\n";
print MAIL "Subject: $FORM{'usrname'} added a new entry to your guest book\n";
print MAIL "$FORM{'username'} added a new entry to your guest book\n";
print MAIL "$guestbook_url\n";
close(MAIL);
On our server to use windmail the first line of this code above would look like this
open(MAIL, "| windmail -t) || die "I can't open sendmail\n";
The version of Perl we are running is version 5.001, HIP Communications build number 109.
Most UNIX-based Perl interpreters require that the first line of the file be a comment
that includes the path to the interpreter. This is unnecessary with this server and is
ignored.
The .pl suffix means that your script will be run by the perlis.dll as a thread in the Web
Server's process context. This is very fast compared with the standard UNIX method of
invoking an entirely new process for each instance of each script.
.pl scripts don't send the initial "HTTP/1.0 200 OK\n". Most browser's response
to this is to assume that the resulting page already starts with both "HTTP/1.0 200
OK\n" and "Content-Type: text/html". If your script tries to send
"Content-Type:..." as is customary, it will appear in your page's output right
at the top. Unfortunately, not all browsers in use make this handy assumption. AOL's
browser is one of those. As noted above, all .pl scripts should first output
"HTTP/1.0 200 OK\n" (or whatever is appropriate for advanced applications) and
then the correct content-type string. For example:
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n"; CGI Utilities :Please
read the notes below before trying to use any of these utilities.
To Start
The following list shows the necessary steps to getting your perl scripts to run on
our server. Keep in mind that just because you have a script that was designed for a NT
server, it still may need to be modified to run on this server. This is especially true if
you are using a script that was originally designed for a unix system.
1. Go into your home directory and make sure that you have a cgi-bin. It should
automatically be there when you first get the account. If it is missing, create your own
directory and name it "cgi-bin"
2. Once you have decided to actually install a cgi script, you must notify the support@net10.net that
you have a cgi-directory to activate. On the subject line include "cgi
activation".
3. When you receive a return e-mail from the webmaster that your directory is cgi
activated you are ready to go. If you have a script that has already been written for you
and is designed for an NT server you should be able to load the script over into your
cgi-bin and go from there. Make sure that if it is a perl script that it ends in a .pl.
For example, if the name of the script is "first", it would be loaded into your
cgi-bin directory as ""first.pl". Only Purl scripts can be uploaded to
cgi-bin directories at this time without prior approval. The policy regarding any
unauthorized scripts or executables is "shoot first, ask questions later". That
is, any *.bat or *.exe files in cgi-bin directories will be deleted if they have not been
pre-approved. Then we'll ask you what they did. Also make sure that you only use scripts
that you have received from a reliable source and which you know exactly what they will
do.
4. Refer to your scripts using a full URL. For example, if your user name is
""montypython",", you might use the tag modifier
""ACTION=http://net10.net/montypython/cgi-bin/script.pl".". You can
actually leave out the ""http://net10.net",", but you have tinkled
your username: "ACTION=/montypython/cgi-bin/script.pl". Top-level domains are
only a little different. The username used to access the site is what is needed before
"/cgi-bin". That is, if your domain is www.mydom.com, and you ftp in with the
username mydom, you would refer to scripts in the cgi-bin directory with
http://www.mydom.com/mydom/cgi-bin/script.pl". If you ftp in with the username
"alphonse",however, the url for "script.pl" would be
"http://www.mydom.com/alphonse/cgi-bin/script.pl". Generally the ftp user id is
the same as the domain name (e.g., mydom.com and mydom), but sometimes there are minor
differences that you need to be aware of: Any Perl scripts should end in the .pl suffix.
The standard: print "Content-type: text/html\n\n"; should be preceded with:
print "HTTP/1.0 200 OK\n"; 5. This should cover most of what you need to know to
get going. Here are a couple of other odds and ends that may help you along.
Programming Notes:
The Web server is a Pentium running NT Server and Microsoft's Internet Information
Server. Perl on this platform is relatively new and not every example program that you
find will run or work exactly as expected. We will be adding NT-specific notes here from
time to time to help you plug some of those holes.
If you are using a perl program that handles forms and you need a mail program such as
send mail on unix systems, we have one. It is called windmail and it handles many of the
same functions as send mail does for unix. Unlike unix systems though you do not have to
specify the exact path to the program.
For example, on a unix system the perl script to send mail would look something like this:
open(MAIL, "| /usr/local/sendmail -t) || die "I can't open sendmail\n";
print MAIL "To: My Name \n";
print MAIL "From: Guestbook@myhost.com\n";
print MAIL "Subject: $FORM{'usrname'} added a new entry to your guest book\n";
print MAIL "$FORM{'username'} added a new entry to your guest book\n";
print MAIL "$guestbook_url\n";
close(MAIL);
On our server to use windmail the first line of this code above would look like this
open(MAIL, "| windmail -t) || die "I can't open sendmail\n";
The version of Perl we are running is version 5.001, HIP Communications build number 109.
Most UNIX-based Perl interpreters require that the first line of the file be a comment
that includes the path to the interpreter. This is unnecessary with this server and is
ignored.
The .pl suffix means that your script will be run by the perlis.dll as a thread in the Web
Server's process context. This is very fast compared with the standard UNIX method of
invoking an entirely new process for each instance of each script.
.pl scripts don't send the initial "HTTP/1.0 200 OK\n". Most browser's response
to this is to assume that the resulting page already starts with both "HTTP/1.0 200
OK\n" and "Content-Type: text/html". If your script tries to send
"Content-Type:..." as is customary, it will appear in your page's output right
at the top. Unfortunately, not all browsers in use make this handy assumption. AOL's
browser is one of those. As noted above, all .pl scripts should first output
"HTTP/1.0 200 OK\n" (or whatever is appropriate for advanced applications) and
then the correct content-type string. For example:
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
E-mail support@net10.net
Phone 707.575.3341 or 1.800.338.6192
|
 |