How do I package my PERL code as a COM component?
March 20, 2000
And so, on to the PDK itself. As we said above, the PDK is the
development environment you use to create Perl COM objects.
The kit itself can be downloaded from:
|
NOTE: The PDK itself operates
in the context of a Perl runtime. As a result, you
must have a Perl interpreter installed in order to use it.
|
The PDK installation process is extremely simple.
The kit is downloaded in the form of a self
installing executable. Double clicking on the file will
start the installation process.
During the installation process, you will be presented
with a number of screens that ask you for preferences
regarding [ amongst other things ] where you want
the kit to be installed, as well as which
components you want installed.
The installation is straightforward - you do not have
to alter any of these choices. Move from screen to
screen, accepting all defaults, and then allow
installation to complete.
When this is done, find the directory where the
installation was placed [ "ActivePerl" by default ],
and navigate to the "bin" sub-directory. Inside the bin
directory, you will find a perl script called
PerlCtrl.pl.
It is this script that is responsible for generating
a COM component from your Perl class.
The first thing to do is to make sure that PerlCtrl.pl
is in your system's PATH environment variable, so
that it can be invoked by name from the command line.
Go to the command prompt, and type "PerlCtrl.pl".
If you receive a screen full of usage instructions about
the script, you are ready to start. If, on the other hand,
you receive an error message telling you that the command
was not recognized, you need to set your PATH environment
variable to include the path to the ActiveState/bin
directory on your system.
Note that if you are uncomfortable modifying your PATH variable,
you can always just call PerlCtrl.pl absolutely such as:
c:\ActiveState\bin\PerlCtrl.pl
|
Congratulations, you are now ready to write your first
Perl COM component.
By way of an example, lets write a COM component that is
capable of sending mail messages via arbitrary SMPT servers.
We will concentrate on the Perl first, and look at the steps
required to package the module as a COM object later on.
How does the IDL describe my object?
Introduction to Perl on Windows - Table of Contents
The Perl Code
|