in reply to Re: Can't locate vars.pm ... sometimes
in thread Can't locate vars.pm ... sometimes

That is actually what the code does. The perl code is generated by the C, then sprintf(cmd,"perl perlfile.pl"); system(cmd);.Also, like I said earlier, it is just ONE process that is both successful and unsuccessful at the same time. Since the process is started, the environment is not changing, so I don't see how that could have any effect on anything.

Replies are listed 'Best First'.
Re^3: Can't locate vars.pm ... sometimes
by iburrell (Chaplain) on Jun 24, 2004 at 19:53 UTC
    I meant don't generate the Perl code from the C code. Save the perl script in a file, put it some place where it can be run, and run it with a similar command line but passing the username or password as arguments. This will make it much easier to maintain and test the Perl script.

    Is the C process continually running and it sometimes fails in the same execution of the C process? Is there anywhere else in the code where the C program gets forked, or changes the environment?

    Do you have multiple perl installations? Is there any possibility it could be running different ones if the PATH changes? It is suspicious that there are two different sets of directories in the library list. Try specifying the full path to the perl program you want to use.

    Other things to try are printing out the command before running. Save the perl scripts and try running them manually with different environments. Compare the perl scripts to see if they are different for failing and successful execution. Print out the environment before running the command.