The reason using strict and warnings is useful is that it helps to ensure that the problem you're having is not actually a problem somewhere else in your script. Making your scripts work with both strict and warnings turned on means that if you are still having the same problem, you've isolated it properly. Otherwise you're shooting in the dark a bit.
Also, it seems as though you didn't read the perlfunc secion on system() as I suggested, or you would have pasted output from a block like this:
if ($? == -1) {
print "failed to execute: $!\n";
}
elsif ($? & 127) {
printf "child died with signal %d, %s coredump\n",
($? & 127), ($? & 128) ? 'with' : 'without';
}
else {
printf "child exited with value %d\n", $? >> 8;
}
That is a very good and reliable way to find the "real" exit code. It may be that your application is being called correctly, but when called from Perl doesn't have access to the same environment, or a myriad other possibilities. When foo.exe exits, you can read it's docs to find the meaning of that exit code and thereby find the problem.
However, until your code works with strict and warnings, you are probably just wasting debugging time.
Larry Wall is Yoda: there is no try{}
The Code that can be seen is not the true Code
|