vit has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,
Everything was fine on Sun in my Perl/CGI program under Tomcat's Web Server
When I moved to Windows XP I have problems to use
system(perl xxx vvv)" and `perl xxx vvv`
inside main perl sctipt.
CGI itself works fine, pages are shown, and when I run the same script from the command line in <cgi-bin> directory like $ perl -w main_cgi.cgi it also works fine.
What can be the cause of this script from script call failure?
  • Comment on Problem when calling script from script in Perl/CGI in Tomcat5.5 Windows XP

Replies are listed 'Best First'.
Re: Problem when calling script from script in Perl/CGI in Tomcat5.5 Windows XP
by moritz (Cardinal) on Jan 24, 2008 at 14:00 UTC
    What does $! say after a failed system?

    Chances are that the server provides different environment variables, and that perl can't be found.

      Thanks for you reply,
      Again everything works running perl in cgi-bin directory, but when I run it through the browser everything is fine except calling perl inside.

      When I use system() it says "cmd in not found in the path..." which is the path to cgi-bin dir where the scripts are..??
      With backtiks call it ia just ignored, so
      @arr = `perl -w xxx "print results to STDOUT"`
      returns an empty @arr.
Re: Problem when calling script from script in Perl/CGI in Tomcat5.5 Windows XP
by Gangabass (Vicar) on Jan 24, 2008 at 16:20 UTC

    Can you explain in more details what the problem is?

    Any log messages? As i see you are calling perl interpreter directly? Did you try to write full path to perl?

      With ` ` I do not have any failures in log.
      I run:
      my @arr = `perl -w $solver_file "$inp_file" "$outfile"`;
      $outfile is just an indication to print to STDOUT
      I have Cygwin and ActivePerl on my machine which starts all pathes with /cygdrive/c/.
      when I type "which perl" in DOS cmd I get
      /cygdrive/c/ActivePerl/bin/perl
      So I tried
      my @arr = `/cygdrive/c/ActivePerl/bin/perl -w $solver_file "$inp_file" + "$outfile"`;
      instead but same result, @arr is empty.
        You may need to make the path-to-perl more windows-like.

        Try

        my @arr = `C:\\ActivePerl\\bin\\perl -w $solver_file "$inp_file" "$out +file"`;
        I suspect the Windows cmd shell may not understand "/cygdrive", or may default to a different Windows drive letter.

             "As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom