Solved

Pel script called using a HTML form??

Posted on 2002-03-05
8
221 Views
Last Modified: 2010-03-05
I have a perl script that I usually run from the command line on an unix machine. Now I would like to call that script passing in parameters from a html form. It will be a simple form with only 2 input boxes. I am not sure this is even possible without using CGI.

Thanks
funim
0
Comment
Question by:funim
8 Comments
 
LVL 19

Accepted Solution

by:
Kim Ryan earned 100 total points
ID: 6842550
You will need to use CGI and store the program on a machine with a web server such as apache. But the actual changes to the script should be very minor.


use CGI;
use CGI::Carp qw/fatalsToBrowser/;

my $query = new CGI;
print $query->header('text/html');
print $query->start_html(-title=>My Demo');

$input1 = $query->param("text1");
print $query->p("My first input field is $input");

...rest of your existing program...

print $query->end_html;
0
 

Author Comment

by:funim
ID: 6842626
Thanks, I will try that tomorrow because I am not sure where to place the perl script. I will let you know.
0
 

Author Comment

by:funim
ID: 6842654
Thanks, I will try that tomorrow because I am not sure where to place the perl script. I will let you know.
0
 
LVL 16

Expert Comment

by:maneshr
ID: 6842885
funim,

".. I am not sure this is even possible without using CGI...."

Yes. This very much possible using CGI. in fact, CGI is meant to do exactly this.

In order to have the HTML form call the Perl script you might have to make small changes.

However, the exact extent of this changes can be know only after you have posted the current code & the HTML form here.

Perl offers the CGI module to make the task easier.

So, here is what i would suggest.

* Post the current version of your Perl script
* Post the HTML form that will eventually call this Perl script.
* Provide details on what should happen after the Perl script has received the HTML form variables

Also, if you can answer the following questions, you can expect to get a more accurate solution, fast.

What OS are you on? Do you have the CGI Perl module installed? Do you have a web server running on your system? Have you configured your web server to run with Perl? Do you have a directory designated as the cgi-bin directory?

Pl. let me know.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Expert Comment

by:webcs
ID: 6843077
Well its not possible not using CGI.  A form is CGI.  So if your using a form your using CGI.  Now, my question is if your using a form then why can't you use CGI, since your already using it to send the form.

The only thing I can think of is you are using a website provider that doesn't allow alteration of formmail or scripts.

If so get in contact with me, I can help you out there and get you a website account where you can alter formmail and scripts.  You definitely need it to do what you want to and I have done this kind of thing before.

Email me, billcom@piniarski.com
0
 

Author Comment

by:funim
ID: 6844546
Going to accept teraplane's answer
0
 

Author Comment

by:funim
ID: 6844548
Thanks this got me on the right track and I was able to figure the rest out.
0
 
LVL 2

Expert Comment

by:webcs
ID: 6844854
There is no need to reject answers if you are accepting one.  You just accept one and leave the rest
alone.  Like everyone else I was just trying to help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now