[Techtalk] Perl script how to

Helen hrosseau at rogers.com
Tue Aug 29 12:30:43 UTC 2006


Thank you for the clarification. I will try that a bit later.  This is what happens when a non programmer is trying to write a program.

Helen
  ----- Original Message ----- 
  From: Tamara Harpster 
  To: Helen ; techtalk at linuxchix.org 
  Sent: Monday, August 28, 2006 4:34 PM
  Subject: Re: [Techtalk] Perl script how to


  Let me see if I can explain a little more on this. You can have the script run at the command line and still not have it activated by the form when the HTML page calls it. And the library I am referring to is a CGI library that allows reading the variables from the web server, for example, the value of the select option that is sent. 

  In order to run the script, you need the following:
  1. In the HTML form, at the top of the form, you need the following tag, with this minimal information:

<form action="scriptname" 
method="get">where the scriptname is the name and location of your script on 
the webserver, for example, for a perl script it might be<form action="/cgi-bin/getform.pl" 
method="get">where the script getform.pl is located in the cgi-bin directory on the webserver2. The webserver has to be configured to allow running your script.
 For Perl in Apache, this is built-in by using an exentsion of .cgifor PHP you have to insall a module for Apache to load. With IIS, when Perl is installed, make sure it installs the option for web server support. And the mime type must be set for the Apache to indicate
what kind of files are to be executed.3. On Linux/Unix boxes the permissions must be set to allow executionfor webserver. 4. The called script or program must have some way of reading the information the web server sends to it, if you want it to respond
to input fields set in the form. 5. For most scripts, they must specify how they are returning thedata, otherwise the web server doesn't know what to do with it.For Perl, this is done by printing out a top line of "Context: text/mime"
which tells the web server that the following print statements shouldbe treated as text. If you were printing out a graphic, you woulduse a different mime type.Once those items are setup, your HTML form can call and activate the 
script. You can test this out by creating a simple script thatprints out a test message just to see if that works, then work ongetting the HTML form field processing.Hope this provides a bit more clarification.
tamara



More information about the Techtalk mailing list