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

using Active State to generate Com object. One major hurdle left.

Registered ok.

Constructor does not invoke

Perl:

my $r = Win32::OLE->new('Chilkat.ZipObject'); loads and returns good status. my $exitcode = $r->ZipAFile("type.txt","Type.zip");

VBScript

Set obj = CreateObject("Chilkat.ZipObject") loads and returns good status. Set rc = obj.ZipAFile("type.txt","Type.zip")
Method ZipAFile fails. Constructor does not invoke.

What is the trick?

Replies are listed 'Best First'.
Re: Perl Com Ojbects
by NetWallah (Canon) on Feb 19, 2016 at 01:21 UTC
    What error do you get in Win32::OLE->LastError() ?

    I don't see the "ZipAFile" method documented anywhere.

    From what I can tell of the API, The call sequence is:

    my $zip = $r->NewZip("Type.zip"); $zip->AppendOneFileOrDir("type.txt"); $zip->CloseZip();

            "Think of how stupid the average person is, and realize half of them are stupider than that." - George Carlin

      The trick is two fold. Have to add

      sub New { return new packagename; }
      Set obj = CreateObject("My.ZipObject") Set objr = obj.New Set rc = objr.zipAFile("type.txt","Type.zip")
      or
      my $r = Win32::OLE->new('My.ZipObject'); print "\nZip DLL error code " . Win32::OLE->LastError(); my $oo = $r->new; my $exitcode = $oo->zipAFile("type.txt","Type.zip");