Item Description: Allows use of many Win32 API calls
Review Synopsis: Great for using that one function that hasn't been CPAN'ed yet.
Every now and then I find a need to call a function that would be second nature if I were using Visual C++ in a Windows environment. I happened across Win32::API, and was very pleasantly surprised at what the module can do.
Win32::API allows functions to be imported from Windows DLL files. It also makes the job much easier by making the actual calling of the function incredibly simple. No more trying to do weird type conversions and stupid pointer tricks - just pack your variables and call the function. If the function doesn't take a structure as a parameter, it's even easier - just call it like a normal Perl sub.
I've had great success at using it, and while I haven't benchmarked any results it appears to be quite fast. Coding the function call is simple, also. It takes longer to research the function and its parameters than it does to write the call. Drawbacks: There are two drawbacks to Win32::API that I've noticed so far. One could be easily remedied, while the other is probably not something I should hold my breath for. Here they are:
- It would be nice if the documentation listed or gave a link to information about what size standard MS parameters are. It's kind of a pain to have to track down what the difference between a WORD and a DWORD is so you know what to pack
- It would be really nice if support for functions that have callbacks. One example I'm thinking of is placing icons in the system tray. To be able to respond to mouse clicks, the function call that places the icon there must specify a callback that gets executed on a mouse click. AFAIK, there is no way to do this yet in Perl, and it may be impossible at the present.
Bottom Line: Win32::API is a great way to build a Windows based Perl solution without having to resort to an MS programming solution because "there's no module that does X".