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

Esteemed Monks,

I have a Perl/Tk application running on Win32, it is a contact manager product.

Another programmer wants to write an application that will pass a short string (in fact it is a phone number) to my application when his code (an IVR type application) answers a call. My caontact manager will then be expected to bring up a contact window and populate it with the database record which matches the phone number.

Is there a convention for naming events? Or do I just think up a name and use it in Win32::Event->new ?

Can I set up and event like this and then go about other things until the event occurs? Can anyone offer a suggestion on how I do this?

jdtoronto

Replies are listed 'Best First'.
Re: Win32 and Events
by GrandFather (Saint) on Oct 06, 2005 at 19:31 UTC

    Just think up a name. But (from MSDN Library):

    The names of event, semaphore, mutex, waitable timer, file-mapping, and job objects share the same name space. If you try to create an object using a name that is in use by an object of another type, the function fails and GetLastError returns ERROR_INVALID_HANDLE. Therefore, when creating named objects, use unique names and be sure to check function return values for duplicate-name errors.

    One way to handle detecting an event firing is to poll using $event->wait([$timeout]). If you set the timeout to 0 the wait returns immediately with one of:

    +1 The object is signalled -1 The object is an abandoned mutex 0 Timed out

    See the Win32::IPC documentation and Win32::Event documentation.


    Perl is Huffman encoded by design.