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

I have ActiveX Perl installed on two Windows servers. On one machine, my "Maintain Teradata LOGINs" applications works just fine. I (destructively) branch from one Perl program to another using the EXEC statement. On the other machine Perl scripts only work when executed from a command prompt. The EXEC statement always fails. This is probably an install and/or environment problem, but am stumped as to where to look. AHWBA (Any help would be appreciated) simpsope

Replies are listed 'Best First'.
Re: EXEC fails, sometimes
by ikegami (Patriarch) on Dec 15, 2005 at 16:17 UTC

    Do you check for errors?

    exec(...) or die("Unable to spawn ... application: $!\n");

    The above would tell you the reason the program couldn't be launched.

      Yes, I get this error text: Invalid Arguement
        Ah, the exec is NOT failing. It's the Perl script that's failing. It doesn't like the arguments you passed to it. You probably used exec("program $arg1 $arg2") without quoting and escaping the contents of arg1 and arg2. (Injection attack vulnerability!) You could properly quote and escape their contents properly, or use exec("program", $arg1, $arg2) which calls the program directly instead of passing the command string to an intermidary shell.
Re: EXEC fails, sometimes
by secret (Beadle) on Dec 15, 2005 at 16:17 UTC
    do something like :
    exec ('foo') or print STDERR "couldn't exec foo: $!";
    What is the error message ?

      Invalid Arguement
        Well, then are you passing the correct arguments ?
        Since they are windows server : be carefull with white space.
        Can you post your the code exec call ?

        update See ikegami's answer , it's much better :|