Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default need your helpppp

    I have a perl script named try.cgi, which is the action value of a form
    containned in
    test12.php file.Part of my try.cgi is as following:

    #!/bin/perl -w
    use strict;
    use CGI;

    $query=new CGI;

    my $nominees=$query->param('n1');
    my $nominations=$query->param('n2');
    my $leaders=$query->param('n3');
    my $followers=$query->param('n4');
    my $filename=$query->param('f1');

    print $query->header();

    exec ("p1.cgi");

    print <<END_HTML;

    <html>
    Debbie523 Guest

  2. Similar Questions and Discussions

    1. flash and variables, helpppp
      I've a question on flash. I guess it's very simple, but I can find the answer anywhere. I want to create a flash movie where I can change some...
    2. HELPPPP ME PLEASE......
      Hey People... I have a flash file inserted into director mx....The flash file works fine, but when i go to the next screen/stage the flash file...
  3. #2

    Default Re: need your helpppp

    Debbie523 wrote:
    > I have a perl script named try.cgi, which is the action value of a form
    > containned in
    > test12.php file.Part of my try.cgi is as following:
    >
    > #!/bin/perl -w
    > use strict;
    > use CGI;
    use CGI::Carp qw{fatalsToBrowser};
    my
    > $query=new CGI;
    >
    > my $nominees=$query->param('n1');
    > my $nominations=$query->param('n2');
    > my $leaders=$query->param('n3');
    > my $followers=$query->param('n4');
    > my $filename=$query->param('f1');
    >
    > print $query->header();
    >
    exec ("pl.cgi") or die "Failed to exec pl.cgi: $!";
    >
    > print <<END_HTML;
    >
    > <html>
    > .
    > .
    > .
    > </html>
    END_HTML
    >
    >
    > p1.cgi is a executable I get from after executing command:
    >
    > gcc -o p1.cgi p1.c
    >
    > in unix shell.
    >
    > And the function of p1.cgi is writing word "welcome" to file op.txt
    >
    > Also it works fine if I use command "p1.cgi" in unix shell.
    >
    > but if I executed from test12.php, after I submit the form there, it
    > goes
    >
    > to page try.cgi and display the value $nominees, $nominations ......(I
    > just let
    >
    > them get printed in <html> section of try.cgi. But it looks like does
    > not
    >
    > execute the command exec ("p1.cgi").Coze I can't see word in op.txt
    > file.
    >
    > I spent a lot time on this question. Could someone help me?
    >
    > Thanks a lot!
    >
    I'm no expert, but ...

    It seems to me that the first thing is to figure out why the exec fails.
    If you read the documentation (hint: perldoc -f exec) you'll see
    something like the code I have inserted. There are differences between
    executing a Perl script from the command line and executing it as a CGI
    script, which include the setting of the PATH variable, and the
    accessability of files in general. Dumping the status of the exec call
    will help you diagnose this.

    But I predict that you will find a second problem when you get the first
    one sorted out, because I predict that when you run try.cgi from the
    shell, you will not get the HTML output, except for the headers, if the
    exec succeeds. See the documentation on exec for the answer to this one,
    too.

    Tom Wyant
    harryfmudd [AT] comcast [DOT] net Guest

  4. #3

    Default Re: need your helpppp


    harryfmudd [AT] comcast [DOT] net wrote:
    >
    > I'm no expert, but ...
    >
    > It seems to me that the first thing is to figure out why the exec fails.
    > If you read the documentation (hint: perldoc -f exec) you'll see
    > something like the code I have inserted. There are differences between
    > executing a Perl script from the command line and executing it as a CGI
    > script, which include the setting of the PATH variable, and the
    > accessability of files in general. Dumping the status of the exec call
    > will help you diagnose this.
    >
    > But I predict that you will find a second problem when you get the first
    > one sorted out, because I predict that when you run try.cgi from the
    > shell, you will not get the HTML output, except for the headers, if the
    > exec succeeds. See the documentation on exec for the answer to this one,
    > too.
    >
    > Tom Wyant
    Tom, thanks for your help and reply. This time after I changed the line

    exec ("p1.cgi") to
    exec ("p1.cgi") or print "failed to exec p1.cgi: $!";

    after execute by browser I got the line :
    Failed to exec p1.cgi: No such file or directory
    displayed.

    I guess you are right, and the browser can't find the file p1.cgi
    So then I guess the set of path is wrong.
    Could you tell me how I should set the path??

    Debbie523 Guest

  5. #4

    Default Re: need your helpppp

    "Debbie523" <Deb.Fang@gmail.com> writes:
    > I guess you are right, and the browser can't find the file p1.cgi
    Browsers don't run CGIs. Servers run CGIs, and forward the output to a
    browser (or other user agent).
    > So then I guess the set of path is wrong.
    > Could you tell me how I should set the path??
    Just supply the full path. exec('/path/to/p1.cgi');

    But don't forget what I said before - exec() does not do what you're
    expecting it to do. Once you get the call to exec() working, you'll
    find that nothing seems to happen after p1.cgi runs. Read the docs for
    exec() (i.e. perldoc -f exec) to see why, and to see how to fix that.

    sherm--

    --
    Cocoa programming in Perl: [url]http://camelbones.sourceforge.net[/url]
    Hire me! My resume: [url]http://www.dot-app.org[/url]
    Sherm Pendley Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139