what's wrong calling a Perl/CGI script in Perl/CGI script under Tomcat server?

Discussion in 'Perl Misc' started by kath, Apr 9, 2007.

  1. kath

    kath Guest

    Hi all,

    I have small doubt, the following code works fine in Apache server.
    But not completely in Tomcat. Why??
    ------------------------
    #!C:\Perl\bin\perl.exe

    # hello.pl

    use CGI;
    $cgi = new CGI;
    print $cgi->header;
    printf "Hello world";
    system("perl Hi.pl");
    ------------------------
    #!C:\Perl\bin\perl.exe

    # hi.pl

    print "Hi";
    ------------------------

    When I tried in Tomcat, the script prints only
    Hello world

    Why?
    What's wrong?


    kath.
     
    kath, Apr 9, 2007
    #1
    1. Advertisements

  2. <snip>

    Why don't you ask Perl
    system("perl Hi.pl") == 0 or die $!;

    and check the server's error log?
     
    Gunnar Hjalmarsson, Apr 9, 2007
    #2
    1. Advertisements

  3. kath

    J. Gleixner Guest

    perldoc -q "Why can't I get the output of a command with system"
     
    J. Gleixner, Apr 9, 2007
    #3
  4. That's not applicable here, is it?
     
    Gunnar Hjalmarsson, Apr 9, 2007
    #4
  5. kath

    J. Gleixner Guest

    Nope.. nevermind.. I missed that 'Hi' was just going to STDOUT, not to a
    variable.
     
    J. Gleixner, Apr 9, 2007
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.