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?


In reply to Program hanging after reinstall by Jobby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.