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

I have written some scripts for automation. But sometimes scripts hangs while executing sleep 10; or any other sleep. Than if i press CNTRL+C on command prompt, it resumes the execution. I wonder if you could let me know the solution. I am using windows XP and perl version - 5.14 Actually my master script calls many batch files and uses modules also as Command::Execute("<some command>"); But suppose I have written one subroutine like inside one module named as Command.pm sub Reset { <do some stuff>; print "completed\n"; } and I call it in master script as Command::Reset(); So, sometimes what happens that print completed comes but the program on the command prompt stucks and when I press CNTRL+C it resumes. So, I am not able to find out the issue what is happening actually. So Please update me that is it possible that system is running so many processes so it just don't schedule that process so it stucks. or I should not use batch files. Thanks & Regards Jitendra

Replies are listed 'Best First'.
Re: Perl hangs within sleep
by flexvault (Monsignor) on Sep 27, 2012 at 13:32 UTC

    Welcome jitendrasingh1386,

    Since you really didn't give enough information to get a 'real' answer, this is just a guess at what could be happening.

    You called another script/program that is waiting for input from the command prompt, and when you type '^C' the script/program terminates and your script gets control again.

    Some additional information like *nix or windows, which Perl version, etc., may help get a better answer.

    Good Luck!

    "Well done is better than well said." - Benjamin Franklin

Re: Perl hangs within sleep
by prashantktyagi (Scribe) on Sep 27, 2012 at 14:57 UTC
    Please use update when edit your question. Follow Writeup Formatting Tips
    CTRL-C signal interrupt for the current task to OS, so naturally your script moves to next task.
    So Please update me that is it possible that system is running so many processes so it just don't schedule that process so it stucks. or I should not use batch files.
    debugging can help you in this. debugging