[Techtalk] Perl script how to

Tamara Harpster tamara.harpster at gmail.com
Mon Aug 28 19:35:03 UTC 2006


Based on your description, it sounds like this is what you are trying to do
one of the following:

1. Have an HTML form with select options. When the user has selected an
option and submitted the form, the HTML page will be redisplayed with the
addition of a text box that has the selected option text in it
2. Have an HTML form with select options. When the user selects an option on
that page, another input field on that page, a text box, is updated with the
information from the selected option.

For option 1 you would use CGI to process the information, for option 2 you
would use Javascript and the DOM to process the event and update the box.
Based on your e-mail, I'm including information about option 1. My apologies
if some of this information seems rudimentary, I'm not sure what background
you already have, and based on your comments I may be providing more
information than you need.

In order to use CGI, you need to be able to process information that the web
server is passing to you. CGI stands for Common Gateway Interface and only
defines what type of information the Web Server will send for a backend
program to process. The reason Perl was recommended is that there is an
existing library for Perl that allows you to get the values from the HTML
form and to process them. The scripting language PHP also has this
capability built in through the use of PHP variables or functions that you
can use.

It sounds like your expect scripts don't have this library for retrieving
the data or are not making use of it. And there are two different formats
for the received data based on the method used in the HTML form. The two
methods are GET and POST. When using the GET , the variables are passed in
with the URL, when using POST, the variables are passed in with the HTTP
request alone and are not duplicated on the URL line. For web applications
that need to pass in large amounts of data or uploading files, POST is the
recommended method, otherwise for debugging purposes, GET works fine.

One resource for Perl scripts is at www.cgi-resources.com, they have quite a
few scripts available, along with some other languages. Or if you want to
use expect scripts, I would recommend looking for a library or set of
routines that would work with a web server to get the CGI information and
pass it to your script.

I hope this was helpful.

tamara

On 8/28/06, Helen <hrosseau at rogers.com> wrote:
>
> I have been researching and reading until I feel like I have banged my
> head
> against a wall enough.  I am looking for help.  I have approached all of
> the
> programmers in my area and I think I am in a different world.  None use
> perl. They all program in C.  And I am not a programmer.
>
> What I am trying to do is have an html page call up my expect scripts via
> something like the select option and output the text to a text area on the
> same html page that called it. One article said to use perl and that would
> solve all my problems.  The problem is I don't know perl.  I can use cgi
> scripts (if I could write them well) but I don't seem to get it right.  I
> have tried to understand how to call the scripts, but I am getting nowhere
> fast.  Frustration has hit a new high.
>
> Does anyone know of either a good script that I can understand to make the
> modifications to, or reccommend another method.  I can run the expect
> scripts and the perl scripts manually, but I can't seem to be able to call
> them from an html page or how to output the results to the same page.
>
> Helen
>
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://linuxchix.org/mailman/listinfo/techtalk
>



-- 
"Do not anger the dragon, for you are crunchy and taste good with ketchup"


More information about the Techtalk mailing list