The Steps Needed to Customize the Template
April 3, 2000
So lets look at the steps needed to customize the template
by going through it in parts:
=POD
=BEGIN PerlCtrl
%TypeLib = (
PackageName =>
'MyPackage::MyName',
TypeLibGUID =>
'{32E6513E-DF20-11D3-B454-00805F9BDE4A}', #do NOT edit line
ControlGUID =>
'{32E6513F-DF20-11D3-B454-00805F9BDE4A}', #do NOT edit line
DispInterfaceIID=>
'{32E65140-DF20-11D3-B454-00805F9BDE4A}', #or this one
ControlName => 'MyApp.MyObject',
ControlVer => 1, # increment if new object with same ProgID
# create new GUIDs as well
ProgID => 'MyApp.MyObject',
PackageName:
This reflects the name of the package in which you
have placed the Perl object.
TypeLibGUID, ControlGUID, and DispInterfaceIID:
As the comments above state, do NOT edit these.
They are the unique identifiers by which the system
upon which the component is registered is going to locate it.
ControlName:
This is the descriptive name you give the component
ProgID:
This is the identifier that the person who uses
your object is going to use to identify and
instantiate it - for example if you were to use
"Server.CreateObject("MyApp.MyObject")", you would
define the following:
DefaultMethod => 'MyMethodName1',
Methods => {
'MyMethodName1' => {
RetType => VT_I4,
TotalParams => 5,
NumOptionalParams => 2,
ParamList =>[ 'ParamName1' => VT_I4,
'ParamName2' => VT_BSTR,
'ParamName3' => VT_BOOL,
'ParamName4' => VT_I4,
'ParamName5' => VT_UI1 ]
The methods section is really a number of repetitions.
It is the section that allows you to describe the
input and output parameters and data types that the
various methods of your object have as their signature.
DefaultMethod:
This is the method that is going to be called
fromm your object if someone uses it in a method
context without specifying a method name. For example,
if your object name is X, and its default method is
Y, then saying X("some argument") will call method
Y on the "some argument" parameter.
Methods:
Provide a method name where the above template
code says 'MyMethodName1'. Specify the total number
of parameters that the method accepts [ Total Params],
and the number of those parameters that are optional
[NumOptionalParams ] .
In the ParamList, where the template code says
"ParamName1" and so on, specify the parameter names
that the method expects. The names you give your params
ought to reflect the names you have given them in your
Perl code - so a parameter labeled $smtpServer
translates to a parameter name of "smtpServer"
in the template code.
Generate the Template
Introduction to Perl on Windows - Table of Contents
Datatypes
|