Executables?

D

Devyn

Hi All!

I'm a newbie to perl. I've written a small cgi script that runs as
the consequence of a form with radio buttons.

After the button is clicked, an exe is to run. How much ever i try, i
cant get that to happen. I hear a "ding" sound which is indicative os
some error.. I can run the perl script in command line using perl
getdata.cgi. I have win98, IE6. Here's the code :-
#!c:\perl\bin\perl.exe



if ($ENV{'REQUEST_METHOD'} eq 'POST')
{

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

@pairs = split(/&/, $buffer);

foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$form{$name}=$value;
}
}

system "front.exe";


if($form{'R1'} eq 'V1')
{
open(a,"Parta.txt");
$stockA=<a>;
close(a);
print"Content-type:text/html\n\n";
print"<html><title></title><body>";
print"<body text=\"\#FFFFFF\" bgcolor=\"#000000\">";
print"\n&nbsp;&nbsp;&nbsp;<p align=\"center\"> <font size=\"5\"
color=\"\#FFFFFF\">The number of part A components in the warehouse is
: </font><font size=\"5\" color=\"\#FF6600\">$stockA</font></p>";
}

......and so on....

Where have i gone wrong? Any help will be appreciated..

Regards,
Devyn
 
G

Gunnar Hjalmarsson

Devyn said:
After the button is clicked, an exe is to run. How much ever i try,
i cant get that to happen. I hear a "ding" sound which is
indicative os some error.. I can run the perl script in command
line using perl getdata.cgi.

Try stating the full path to the .exe file:

system('C:/somepath/front.exe') == 0
or die "executing front.exe failed: $?";

See also

perldoc -f system
 
D

Devyn

Gunnar Hjalmarsson said:
Try stating the full path to the .exe file:

system('C:/somepath/front.exe') == 0
or die "executing front.exe failed: $?";

Hi!
Thanx for the reply. I tried including this in my program, but it
didnt work. Let me give out a few more details.

The cgi-script is in the same drectory as the front.exe Front.exe uses
the parallel port (i'm usin win98..)and generates 3 txts. The script,
which continues to run, reads these txts based on the decision made in
the radio button form and displays a message.

I still get that ding sound when i run the script from the browser i.e
clicking on the button in the form. However "perl getdata.cgi" in the
command prompt works smoothly. Where am i going wrong?

Devyn
 
J

Jürgen Exner

Devyn wrote:
[...]
I still get that ding sound when i run the script from the browser i.e
clicking on the button in the form. However "perl getdata.cgi" in the
command prompt works smoothly. Where am i going wrong?

Please see "perldoc -q 500"

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top