BoBoĻ Guest
|
Posted: Wed Oct 10, 2007 8:50 am Post subject: PerlCOM / PerlCtrl - using Perl with AHK via COM ??! |
|
|
| Quote: | [...] On Win32, you can use PerlCOM and PerlCtrl to use Perl in surprising places. Both PerlCOM and PerlCtrl are based on COM (Microsoft's Component Object Model), which allows you to glue objects together at run-time in a language-independent way. It's language-independent because you can access a COM object written in C++ from Perl or Visual Basic, a COM object written in Perl from C++ or Visual Basic, and so on. If you can develop a COM component in one language, you can use that component from any other language that supports COM. I'll demonstrate both PerlCOM and PerlCtrl in this article. We'll use PerlCOM to use a Perl module, Net::Ping, from COM. Then we'll use PerlCtrl to turn a chunk of Perl code, Vector.ctrl, into an ActiveX control that can be embedded in a web page.
COM provides the low-level mechanisms to glue objects together. There are two ways to create controls with COM: OLE and ActiveX. OLE (see TPJ #10) is the bulkier of the two, providing services for desktop applications, such as facilities for creating compound documents. ActiveX is a slimmer version of OLE that was originally optimized for embedding controls in web documents. However, you can use ActiveX and OLE controls in applications written in a high-level language such as Visual C++, Visual Basic, or Perl.
Perl developers can use PerlCOM and PerlCtrl to leverage Perl in a COM environment. For example, if you've got a spreadsheet that needs to do some heavy regular expression work, you can use ActiveState's PerlCOM or PerlCtrl to call on Perl without having to embed Perl in the spreadsheet program itself. PerlCOM is an ActiveX component that exposes a Perl interpreter, and PerlCtrl is a tool that lets you develop ActiveX controls in Perl. ActiveState's PerlCOM and PerlCtrl are included with the Win32 Perl Resource Kit, which is published by O'Reilly and Associates. PerlCOM and PerlCtrl may also be available separately in the future. Keep an eye on http://perl.oreilly.com and http://www.ActiveState.com for details.
WHAT ARE PEOPLE DOING WITH COM?
People are developing all sorts of groovy things with COM - there's no shortage of ActiveX controls available to web developers. These include simple plugins such as the multimedia viewers to sophisticated tools like the WinFrame client, which allows you to launch remote Windows applications within your browser. ActiveX controls are available for application development as well, such as hierarchical data controls to data engines for performing mathematical manipulations.
Wouldn't it be neat to be able to tap in to Perl's richness from within Visual Basic or a desktop application like Word or Excel? With PerlCOM or PerlCtrl, it's no trouble to add powerful WWW access to your application with something like libwww-perl.
VBSCRIPT FOR THE SAKE OF DISCUSSION
I'm going to use VBScript to showcase the talents of PerlCOM and PerlCtrl. Although VBScript is, at best, a lightweight development tool, it is ideal for what we need to cover in this article. [more...] |  |
|