|
CGI (Common Gateway Interface) with Perl (Practical extraction and report language). Here's how Perl works on a UNIX box, and an example of the form to mail Perl! First, you'll need to get Perl, if you don't already have it. The place to get it is The Perl Institute, and a Perl compiler to compile and run your scripts before uploading them. WinPerl (.zip file download 827KB) is a very good Windows 95 program to compile with, and its freeware. Next, you'll need a good FTP (File Transfer Protocol) program, I recommend WS_FTP95 LE for Windows 95, (.zip file download 565KB) for personal use, its also free. You'll need to create a directory in your public_html directory called cgi-bin. This is where you will upload all your Perl to. In your form use <FORM METHOD="POST" ACTION="http://www.rollanet.org/cgi-bin/cgiwrap/your username here/frm2mail.pl >, next for <INPUT TYPE="HIDDEN" NAME="AAFormID" VALUE="PartsQuote"> just change the VALUE to whatever name you want to identify it with which form it came from. Here is the form2mail.pl, just copy it and paste it in a text editor (notepad), then save it as form2mail.pl. You'll need to edit it so it will send the form data to you, and put whatever background and links you want. This is what it looks like:
#!/usr/local/bin/perl
# frm2mail.pl -- return form data via email
$email = "mdoc\@rollanet.org";
read(STDIN, $formdat, $ENV{'CONTENT_LENGTH'});
open(MAILOUT, "| mail $email") ||
die "Can't start mail program.";
@namevals = split(/&/,$formdat);
foreach (@namevals) {
tr/+/ /;
s/=/ = /;
s/%(..)/pack("C",hex($1))/ge;
print MAILOUT "$_\n";
}
close(MAILOUT);
print "Content-type: text/html\n\n";
print "<HTML><HEAD>\n";
print "<TITLE>Form Data Sent</TITLE>\n";
print "</HEAD><BODY BACKGROUND=~mdoc/backgrds/whiteroc.gif>\n";
print "<H1 ALIGN=CENTER>Form Data Sent</H1>\n";
print "<P ALIGN=center>\n";
print "Your completed form was delivered.<BR>\n";
print "Thank you for visiting Micro.doc\n";
print "</P>\n";
print "<P ALIGN=CENTER><FONT SIZE=2 FACE=ARIAL>\n";
print "| <A href=/~mdoc/perl.htm>CGI & Perl</A> \n";
print "| <A href=/~mdoc/dos-unix.htm>DOS-UNIX</A> \n";
print "| <A href=/~mdoc/index.htm>Index Page</A> \n";
print "| <A href=/~mdoc/linux.htm>Linux</A> \n";
print "| <A href=/~mdoc/linuxnet.htm>Linux & Netscape</A> \n";
print "| <A href=/~mdoc/linuxppp.htm>Linux PPP</A> \n";
print "| <A href=/~mdoc/novell.htm>Novell</A> |<BR>\n";
print "| <A href=/~mdoc/plugins.htm>Plug-Ins</A> \n";
print "| <A href=/~mdoc/research.htm>Research</A> \n";
print "| <A href=/~mdoc/ssi.htm>Server-Sides</A> \n";
print "| <A href=/~mdoc/unix.htm>UNIX</A> \n";
print "| <A href=/~mdoc/vi.htm>vi Editor</A> \n";
print "| <A href=/~mdoc/webdev.htm>Web Development</A> \n";
print "| <A href=/~mdoc/winnt.htm>Windows NT</A> |\n";
print "</FONT></P>\n";
print "</BODY>\n</HTML>\n";
# end of frm2mail.pl
When you upload your Perl, you must do it in ASCII mode and then modify the permissions to make it executable. For WS_FTP users, this is accomplished by first clicking on the ASCII mode radio button, then double-click your Perl to upload. After you've uploaded your Perl single click on it, then right click on it to bring up the pop-up menu, go down the menu to chmod (UNIX) and click on it, this brings up the permissions options, check execute all the way across. Test it, and you're in business! |
Please e-mail me your
comments / suggestions!
![]()
CGI with Perl | Cisco Systems | DOS to UNIX | EIA/TIA 568 Standard | Hardware Resources | IEEE 802.3 Standard | Index Page | Linux | Linux & Netscape | Linux PPP | Misc. Links | Novell | OSI Model | Server-Side Includes | Software Resourses | UNIX | vi Editor Commands | Web Development | WebMaster Defined | Windows NT/2000