Jobby has asked for the wisdom of the Perl Monks concerning the following question:
I use a silly little script to display a countdown and then start Winamp playing after it's done. Recently I had to reformat my computer, and I found that after I had reinstalled the latest version of Activestate Perl, the script would hang with 100% CPU usage between 5 seconds and a minute after being started. What's going on here?
#!perl use Win32::Console; my $con = Win32::Console->new(); sub snooze { #generate random snooze time return (11*60) + rand(60*5); } sub display_countdown { my $countdown = shift; $hours = ($countdown/3600)%24; $mins = ($countdown/60)%60; $secs = $countdown%60; if ($hours < 10) { $hours = "0".$hours; } if ($mins < 10) { $mins = '0'.$mins; } if ($secs < 10) { $secs = '0'.$secs; } $con->WriteChar('[' , 0, 0); $con->WriteChar($hours, 1, 0); $con->WriteChar(':' , 3, 0); $con->WriteChar($mins , 4, 0); $con->WriteChar(':' , 6, 0); $con->WriteChar($secs , 7, 0); $con->WriteChar(']' , 9, 0); $con->Display; } my $c = eval($ARGV[0]); $SIG{INT} = 'IGNORE'; while(1) { while ($c > 0) { display_countdown($c); sleep(1); $c--; } system(q(C:\Program Files\Winamp\PlayPause.exe)); $c = snooze; }
I've tried not using Win32::Console and removing the interrupt signal handler line but to no avail. Other scripts seem to run OK. Also, I can make the script hang earlier by viewing the process information for perl.exe in systeminternal's process explorer. I've no clue what's going on - any ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Program hanging after reinstall
by spiritway (Vicar) on Mar 22, 2006 at 06:19 UTC |