Executables?

Discussion in 'Perl' started by Devyn, Apr 10, 2004.

  1. Devyn

    Devyn Guest

    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
     
    Devyn, Apr 10, 2004
    #1
    1. Advertising

  2. Devyn wrote:
    > 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

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Apr 11, 2004
    #2
    1. Advertising

  3. Devyn

    Devyn Guest

    Gunnar Hjalmarsson <> wrote in message news:<pn%dc.55724$>...
    >>

    > 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
     
    Devyn, Apr 11, 2004
    #3
  4. 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
     
    Jürgen Exner, Apr 11, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greg
    Replies:
    0
    Views:
    334
  2. Kaidi
    Replies:
    4
    Views:
    2,805
    Kaidi
    Jul 14, 2004
  3. Sue
    Replies:
    1
    Views:
    1,087
    Andrew Thompson
    Jun 7, 2005
  4. Steve
    Replies:
    0
    Views:
    388
    Steve
    Jul 1, 2005
  5. Francesc Guim Bernat

    .NET executables and XML, i need help :-(

    Francesc Guim Bernat, Sep 17, 2003, in forum: C++
    Replies:
    2
    Views:
    363
    Pianoman
    Sep 19, 2003
Loading...

Share This Page