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

As is apparent from the 5.6.1 release notes, the alarm function is not implemented on Windows environments.

I am trying to write a Tk app which includes a label showing a time ticking forward every second. Implementing this in VB is no problem as I just place a timer object on the desktop. How can I achieve the same thing in Perl? Is there a CPAN module that will help?

I've looked at Sys::AlarmCall and Time::Hires, but neither of these emulates alarm on Windows.

Any help would be appreciated.

Replies are listed 'Best First'.
Re: alarms and timers on Win32
by MZSanford (Curate) on Oct 23, 2002 at 12:52 UTC
    You could use Tk::After (doc) and give it a callback and time ... i am not sure if that will work on Win32, but i believe so. If you want to get really tricky, you could also use Win32::OLE or Win32::API to access the VB timer object, or other Win32 naitive function, directly. Lastly (and, i am sure this is not the last, but the last i have right now), you could fork a process to keep track of the time, and use IPC to update the label ... seems a bit complex for what you want though. Also, a pretty good clock inplimentation is here(analog), or maybe Tk::Clock ?
    from the frivolous to the serious
      Fine! Tk::After was what I was looking for. Thanks.