tbone1 has asked for the wisdom of the Perl Monks concerning the following question:

Fellow monks:

I work for a small shop which has IT divided into Unix/Oracle on this side and VB/Java on the other side. (That in itself is a long story and you don't want to be bored by it.) Not long ago I gave an 'intro to Perl' talk and people on the VB/Java side fairly leapt at it.

One of them just asked about embedding Perl in VB. Being a Unix/OS X guy, I know NOTHING about this, except 1) Perl is a great glue language and 2) she can't be the first person to want to do this. Her search turned up a couple things that might work, but I decided to ask for recommendations based on your collective experience and expertise.

Thanks.

--
tbone1
Ain't enough 'O's in 'stoopid' to describe that guy.
- Dave "the King" Wilson

Replies are listed 'Best First'.
Re: Embedding Perl in VB
by jplindstrom (Monsignor) on May 20, 2003 at 19:37 UTC
    Using ActiveState's PDK (PerlCtrl) you can create COM/ActiveX objects. So you can CreateObject() Perl classes from within VB.

    That's kinda neat.

    /J

Re: Embedding Perl in VB
by theorbtwo (Prior) on May 20, 2003 at 19:17 UTC

    I've done this, more or less, with Excel and VBA, in the past. It's quite convient. I simply created a Microsoft Script Control object, eval'd do 'file.pl', then eval()'d my real code. It was easy -- had all the advantages of VBA, and all of the advantages of perl.

    Unfornatly, I can't seem to find the excel sheet, only the perl code, which isn't very interesting.


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Re: Embedding Perl in VB
by Jenda (Abbot) on May 20, 2003 at 21:31 UTC

    I second the PerlCtrl suggestion. I'm using PerlCtrl generated DLLs in VB programs as well as in ASP pages without problems. The only issue you have to take care of ... PerlCtrl generated DLLs need to be able to extract the Perl5x.dll and the DLLs of all modules to the TEMP directory. It used to be possible that it extracted the files there under one account and then was unable to read them under another, but since the TEMP directory used by PerlCtrl is supposed to be per-user now this should not longer be a problem.

    P.S.: They might like Jenda.Rex.

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature

Re: Embedding Perl in VB
by tbone1 (Monsignor) on May 22, 2003 at 12:56 UTC
    Thanks for the suggestions! You've probably saved us a good bit of headache, not to mention wear and tear on the programmers.

    --
    tbone1
    Ain't enough 'O's in 'stoopid' to describe that guy.
    - Dave "the King" Wilson