[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

PerlCtrl - Method Param List

Posted on 2004-09-15
1
Medium Priority
?
260 Views
Last Modified: 2008-02-01
hi.

some more questions on PerlCtrl.

1)
What good are the names in the ParamList Section of the Typelib?

Like

ParamList           =>[ ParamName1 => VT_I4,
                                ParamName2 => VT_BSTR ],

i understand that such a method will take 2 typed parameters, but what are the names for?

i CANNOT do

%h = @_;
print $h{ParamName1};

so what?

2)
similarly

TotalParams         =>  2,
NumOptionalParams   =>  0,

seems to have no effect. when i say TotalParams => 2 i still can call the function (from vbscript) with 3 or more parameters. why? is it maybe different from other languages?

3) is there any good tutorial/documentation for perlctrl, the one from activestate is poor.

tx, holli





0
Comment
Question by:holli
1 Comment
 
LVL 18

Accepted Solution

by:
kandura earned 2000 total points
ID: 12069697
The ParamList is just there for the benefit of consumers of your COM object. It will tell them which parameters (and of which type) this method accepts.

I mean that when you view the object's typelib in e.g. the OLE Browser, you will see something to the effect of

    interface HelloWorld : IDispatch {
        VT_BSTR returnArray( ParamName1 VT_I4, ParamName2 VT_BSTR )
    }

In Visual Studio the Code Completion would also show something like that. When you add your object to the toolkit and when you use the object, call the method, then the VS compiler will check the arguments against your typelib definition.

Of course, perl is not very fussy about type or the number of arguments to functions, so you have more flexibility that in e.g. C#.
Nonetheless, it may be wise to be as strict as possible, and even use prototypes in perl, just to avoid creating undocumented interfaces.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question