in reply to More on OLE from Perl

You say that you have some VB examples. Looking at them should give you some idea of what name to use in Perl. Perhaps it's a CLSID? If so, you do something like:

my $app = Win32::OLE->new('{12345678-9ABC-DEF0-1234-56789ABCDEF0}'); # substitute the real CLSID or ProgID

Would you show us the VB examples and the Perl code that you tried? We give much better answers if we have something to work with.

Replies are listed 'Best First'.
Re^2: More on OLE from Perl
by wa4otj (Beadle) on Jun 14, 2004 at 06:28 UTC
    Ok, here's the setup from the VB form sample. Note the CLSID string, and the reference to the ocx module.
    VERSION 5.00
    Object = "{9EA22D70-0EAA-4F54-80BB-3AA640DF1B96}#2.0#0"; "HALi.ocx"
    Begin VB.Form Form1 
    ...blah...blah...
    
    So I tried this
    use Win32::OLE;
    my $HALi = Win32::OLE->new('{9EA22D70-0EAA-4F54-80BB-3AA640DF1B96}');
    
    When I run it, it does not return any errors. Cool!

    So I move to the next step and add the init function.

    The VB init is:

    HALi.Init()
    
    So I translate this to:
    $HALi->{HALi}->Init();
    
    I get a "Can't call method Init on undefined value" error.

    It's late and I'm tired, and probably missing something obvious. I'm getting past the server creation, but hanging on the init function. Maybe a fresh look tomorrow will show me the error of my ways. Suggestions appreciated.

    Nathan

      It looks like all you need is $HALi->Init();. The extra ->{HALi} wasn't in the VB snippet you provided.
Re^2: More on OLE from Perl
by wa4otj (Beadle) on Jun 13, 2004 at 22:55 UTC
    Yes, they have the CLSID. Doh! Using that never occurred to me. I'll try it.

    Nathan