Solved

PerlCtrl - Method Param List

Posted on 2004-09-15
1
240 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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.…
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…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

932 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now