Solved

Executing Local Script

Posted on 1997-12-28
8
155 Views
Last Modified: 2013-12-25
Very simple question here...  When the user presses on the submit button on my form, I would like to pass the form information to a perl script which is located in the same directory as the .HTML page on the user's computer.  I have no way of knowing what that directory is...  All I know is that the .HTML and the .PL files are in the same directory.

Here's the "ACTION" statement that I've tried, among other things...  Why doesn't it work?

ACTION=".\getform.pl"

I only give the ACTION because I'm pretty sure everything else is OK.  I'm almost positive that the problem has to be in that statement.

Thanks in advance,

COlin
0
Comment
Question by:colind
  • 4
  • 4
8 Comments
 
LVL 5

Accepted Solution

by:
icd earned 100 total points
ID: 1831753
The most likely reason is that the server is set up so that scripts and html documents cannot be in the same directory.

Usually cgi scripts are limited to running in a separate directory tree starting in 'cgi-bin'.

It is possible to set up the server to allow cgi-scripts to run from any directory. This is considered to be less secure than the more normal method. Note however that Experts Exchange seems to be set up this way! Check with your system administrator.

If this is not possible it might be possible to do what you want using relative or absolute addresses.

Relative...  "../../cgi-bin/getform.pl"
Absolute...  "/cgi-bin/getform.pl"

The first will work from any first level directory on your site, the second will work from any directory on your site.
0
 

Author Comment

by:colind
ID: 1831754
It is not running on any server.  Essentially, I have a program in PERL that is meant to be run from a user's hard-drive, completely independant of the internet.  I'm using CGI so that my program can have a pretty .HTML interface instead of the ugly command line interface.

I'll try creating a directory called cgi-bin and storing my scripts there but it seems to me that there should be a way to have an .HTML file which calls a script in the same directory.

Can you suggest anything else?

Colin
0
 

Author Comment

by:colind
ID: 1831755
Oh, I forgot to add that I don't know the name of the directory that this script and .HTML file are going to be store in, so I don't think "../../cgi-bin/getform.pl" would work.  Isn't that relative idea the same as putting "./getform.pl" with "." being the current directory.

Colin
0
 
LVL 5

Expert Comment

by:icd
ID: 1831756
Ah, I see.

To run scripts you have to have a server. I do something similar on my PC because I test my web site before I upload it. To run scripts (on a PC) you need PWS (Personal/Peer Web Server) from Microsoft. You presumably already have the perl interpreter.

It is possible (I think) to run scripts from the same directory as the documents if it is installed correctly.

If you don't like the idea of installing PWS (since you persumably want to run this program on your customers PC's) then I am afraid that there is no alternative. Although standard HTML can be run from 'open file' menu of your browser there is no way to run scripts from the local file system. If you try to run a script you will just get the contents of the script sent to the screen.

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:colind
ID: 1831757
Well, that really sucks.  Yes, my plan was to "compile" my script using Perl2exe.exe (to make a stand-alone executable) then to use a .HTML file for my interface.  I'll give you the points but can you suggest another alternative to having the command line interface?  Are there any PERL modules that can offer me a Windows interface with message boxes and all that fun stuff?

Thanks again,

Colin
0
 
LVL 5

Expert Comment

by:icd
ID: 1831758
You problem is one I have given much though to myself since I had a similar application some months ago. In all that time I have not seen or come up with an easy solution.

I have however seen a company that distributed data on CD-ROM. The provided their own browser and ISTR that they could run scripts or executables. Writing your own browser however is a big and pointless job.


0
 

Author Comment

by:colind
ID: 1831759
At the same time that I posted that last comment, I posted a question in the PERL area and got an answer from nanulnet.  Check out the following URL...  It looks like it will give us access to the Win32 API.


http://194.247.167.1/DADA/PERL/API/index.sht 
0
 
LVL 5

Expert Comment

by:icd
ID: 1831760
Thanks for feedback on that approach. My problem was that I *must* use HTML and a web browser (since that is platform independent etc). Your problem is not that you must use HTML but that you must run your perl script. The answer by nanulnet would seem to solve your problem of what interface to use. I hope it solves your problem.
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

Title # Comments Views Activity
Convert OverPunch 25 62
Need help deploying an MSI via silent install using PSEXEC 4 61
Powershell / new-object PSObject rows 2 233
AWS CLI issues with Tags 3 66
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to count occurrences of each item in an array.

867 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

19 Experts available now in Live!

Get 1:1 Help Now