On Sep 15, 2012, at 2:46 PM, jmrhide-p...@yahoo.com wrote: > As requested, I ran perltidy on my script to see if I could make it easier > for > somebody else to read. Perhaps a little explanation of how it works would > also > be helpful:
[explanation snipped] > To avoid repetition of previous discussions, let me remind everybody that > this > script works perfectly every time as far as I can tell. That is to say, it > never hangs and always gives the expected result. Also, with all the > error-checking turned on, no error appears on the server log. The mysterious > problem is that the script apparently doesn't terminate as expected. > Although > opportunities for mischief abound in any 500-line script, they all appear > BEFORE the output stage. Since the output is as expected, I'm having trouble > imagining what would cause the script to fail to terminate. Except that the program does NOT work every time. It sometimes leaves behind one or more copies that are expending excessive amounts of CPU, enough that the sysadmins of your server have to terminate your program and banish it from their system. It is impossible to test a program under all possible conditions. It is impossible for anybody else besides you to test your program, because it depends upon the data file read by the program. Users can always do unexpected things with a program, breaking it in spite of extensive testing. So the program can still misbehave despite that fact that it always works when you run it. I have looked at your script carefully, as have others. You have been advised to clean it up. While that is a good idea for future development, it will not fix your termination problem. You have also been told that the while (1) loops are a potential problem. I don't see anything else in your program that would prevent it from terminating. There are 21 such loops in your program. If any of those loops fails to exit, your program will not terminate. You will not get any errors in the error log, because the program did not generate any errors. Without doing extensive testing, debugging, and tracing of your program, this seems like the most likely candidate for your problem. I would suggest replacing the while(1) loops with for(1..5). That way, the loop will give up and terminate after 5 tries if it gets stuck trying to generate a unique number. If you want to confirm that this is the problem, then you can add a test for the condition you are trying to avoid after each such loop and print an error message (somewhere) if the loop ran to completion and did not terminate because of the 'last' statement. > I'm sure this script isn't up to professional standards, and becoming an IT > professional is not among my ambitions. I'm offering the script free to > users > as a public service, and I just want to find a way to do that without > crashing > Hostmonster's servers. Your assistance will be sincerely appreciated. There are many ways in which your program could be improved, but you do not seem interested in doing so. I am not sure what additional assistance anyone can give you. Good luck. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/