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.
|