Solved

PerlCtrl - Method Param List

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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
How to join two different databases in one sql select statement in Perl using DBI? 9 68
SIMPLE Perl Regex 1 164
perl CPAN issue 3 121
Perl Awk Need Help 3 137
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 …
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…

740 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