http://qs321.pair.com?node_id=595318

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

Hello Monks,
I am attempting to use ESRI's COM Object Model, however ESRI does not support dual interfaces. Has anyone had any experience in this area? I downloaded a Script Adapter to attempt to wrap the object however it doesn't seem to work. Below is a snippet of the code using the adapter that I couldn't get to work if someone has experience using this adapter or using another method that would be just wonderful..
my $adapter = Win32::OLE->new("ScriptAdapter.Adapter"); my $mapDoc = $adapter->WrapObject($esriRenderer->MapDocument); print $mapDoc->DocumentFileName;
Thanks,

Replies are listed 'Best First'.
Re: Dual Interface
by shmem (Chancellor) on Jan 19, 2007 at 00:53 UTC
    Not that I had a clue, but I just can't stand questions that don't somehow get answered. Your question has been sitting around some time now. There are reasons for such fate; reading How (Not) To Ask A Question could help. Why not also read How do I post a question effectively?

    What are you trying to do? Maybe you you have an XY Problem. But maybe statements won't help.

    I'm not a Windows guy, but I have a VMware Windows installation which I fire up now and then (perl installed, of course) to look at weird things...

    Before I can even consider helping you, I must be answered on

    • What the heck is ESRI?
    • What do you mean with "dual interface"? as opposed to "single interface"?
    • What is the ScriptAdapter (for)? is it some dll collection?
    • Is that ESRI/ScriptAdapter stuff available without charge, and if so, where?

    I can answer (some) perl questions, spending my free time, but not spending my (unfree) money. And I won't spend my time googleing just to fill an information gap you left open; a search for ESRI on CPAN doesn't return anything.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      Well thanks for taking the time to respond to my question. I can first say that I am not having an XY Problem but thanks for that link it is much appreciated.
      Now on to answering your questions. Your searching on CPAN for ESRI returned nothing because ESRI is a company ESRI they provide an automation interface to their product through COM. For a explanation of COM CLICK HERE.
      On the Dual Interface question this is common terminology in the COM world. You can certainly read about that BY CLICKING HERE.
      For the Adapter that I downloaded ADAPTER it is free and this provides late bounding support to COM objects which do not support IDispatch, which is the overall goal of my excersise. Sorry if my original post was unclear I assumed anyone that would respond would have a solid understanding of COM Automation.
      Thanks Again for your time,
      Mike

      The question seems pretty clear to me. The simple breakdown of the question is that he needs to use an COM object model, which is part of ESRI's software, but that doesn't matter. The important part is that the interfaces only implement IUnknown(single interfaces). As opposed to interfaces that implement IDispatch and IUnknown(dual interfaces). IDispatch allows for the user to get type information at run-time, which I believe is needed for perl to use COM objects.

      My guess is the Script adapter is a dispatch layer on top of the IUnknown interfaces.

      I don't know of any way to do this in perl.

      Also, if you're not a COM/Windows guy, you probably shouldn't be responding to a COM question. Using a very common term such as "dual interface" is perfectly acceptable, because anyone whose used COM before knows what it means.

      - Tom

        Also, if you're not a COM/Windows guy, you probably shouldn't be responding to a COM question. Using a very common term such as "dual interface" is perfectly acceptable, because anyone whose used COM before knows what it means.

        That sounds reasonable; I agree. I'll refrain from answering those questions in the future (unless I'll have to do more with COM/Windows by any odd chance ;-)

        Apologies to the OP.

        --shmem

        _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                      /\_¯/(q    /
        ----------------------------  \__(m.====·.(_("always off the crowd"))."·
        ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

      This is why search on CPAN (as useful as it sometimes is) is not always helpful. There are two different search engines on cpan (search.cpan.org and kobesearch.cpan.org). Searching for 'ESRI' on search.cpan.org doesn't return anything because there aren't any modules that have the word ESRI as part of the module name. The kobesearch engine searches the content of module documentation, and searching there for 'ESRI' turns up several modules that mention it, but returns different modules depending on what you search. Searching kobesearch for 'ESRI' in 'Distributions' returns Geo::Shapelib and XML::Generator::SVG::ShapeFile. Searching in 'Modules' returns those two plus Geo::E00. Neither search finds my own Geo::ShapeFile module, which I know mentions ESRI in the documentation several times.


      We're not surrounded, we're in a target-rich environment!