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

Hi, I have a cgi script, fine no problems, but i would like it to execute another perl script in the same directory. I have tried using the sytem "perl name.pl" but it does not execute. Any other ways of doing this? Thanks

Replies are listed 'Best First'.
Re: cgi system call
by polettix (Vicar) on Jun 17, 2005 at 23:26 UTC
    Look for errors in the logs. Activate errors on broswer:
    use CGI::Carp qw( fatalsToBrowser );
    get the error and deactivate error dumping (it could lower your security).

    Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

    Don't fool yourself.
Re: cgi system call
by jZed (Prior) on Jun 17, 2005 at 20:09 UTC
    Are you sure it's "in the same directory"? CGI scripts may execute in a different directory than their physical location. Try using an absolute path to the second script (not a URL, a path). What error message do you get from running the second script?
      Also, give the full path to the perl binary, as it might not be in your current directory or path.

      Matt
Re: cgi system call
by cool_jr256 (Acolyte) on Jun 17, 2005 at 20:58 UTC
    Check your permissions.....
    also a cut'n'paste of the error you get would be helpful...
Re: cgi system call
by tcf03 (Deacon) on Jun 17, 2005 at 20:18 UTC
    do "script.pl"

    Ted
    --
    "That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
      --Ralph Waldo Emerson
      i have tried the full path location, the script it self works fine on its own. is that do "perl name.pl" a complete command?
        you dont need perl in front of name.pl => do

        update - try do 'script.pl';

        Ted
        --
        "That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
          --Ralph Waldo Emerson