?
Solved

PerlCtrl - Method Param List

Posted on 2004-09-15
1
Medium Priority
?
252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
Six Sigma Control Plans

762 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