Solved

PerlCtrl - Method Param List

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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 …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

760 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

22 Experts available now in Live!

Get 1:1 Help Now