Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

COM Objects and the need to know more

by moggs (Sexton)
on Apr 21, 2008 at 14:09 UTC ( [id://681923]=perlquestion: print w/replies, xml ) Need Help??

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

Hi

Having done lots of searching for information on linking to COM objects in PERL (a job that would be much easier if they were called something else), I have found I need help.

Basically, we have a Foxpro Application and need to share data accross the web and read it in to a MySQL DB. After a user has edited it (no problem there) it should be transferred back. The app's developer simply says "we'll build a COM object and you can query that". Here's the problem... I don't really understand COM objects! I have a read they're related to OLE, but the web server is on Linux and the app is on a Windows server.

Does anyone know of any links where I can find out more? Is this possible using PERL to access a COM Object over the web or would some other solution be more appropiate? I can't find anything particularly useful on CPAN, but then I don't really know what I'm looking for.

I know it's not strictly a PERL topic, but any help or ideas would be truly appreciated.

-- moggs!

Replies are listed 'Best First'.
Re: COM Objects and the need to know more
by Corion (Patriarch) on Apr 21, 2008 at 14:17 UTC

    You have several obstacles in your course which might or might not be easy to navigate:

    Perl cannot easily access COM objects. Any access to COM requires Perl on Windows1. If they are OLE objects, you can easily access them on the Windows machine by using Win32::OLE.

    If you need the data on Linux, either push the data from Windows to the Linux MySQL database using ODBC and/or DBD::MySQL or serve the data retrieved from the OLE object as files or via a Perl program to the Linux machine.

    1 I know that technically you can use COM over the network by using DCOM and/or SUN/RPCE, but as I have done so in a former life, I wouldn't recommend this to anybody without dire need.

Re: COM Objects and the need to know more
by holli (Abbot) on Apr 21, 2008 at 17:37 UTC
    we have a Foxpro Application and need to share data accross the web and read it in to a MySQL DB. After a user has edited it (no problem there) it should be transferred back.
    I guess using Foxpro is the real wtf here =)

    Anyway, as already stated you cannot use OLE on the linux server side easily, so I suggest that you create some kind of Server/API on the application machine and let your webserver communicated with that, instead of directly to the DB. Then you can use any protocoll you want and you abstract away database specicfic code on your webserver.

    You get the idea. The possibilities for implementing this are endless. Chose from plain get/post, soap, xml-rpc, csv, or whatever for transportation and HTTP::Server::Simple, Catalyst, Jifty, etc. for the code. Writing a simple CRUD application with one of the advanced frameworks is a piece of cake. You should be able to set one up within minutes. While I'm at it, I think I should also point you at DBD::Xbase, just in case you didn't already know about it.

    update: I forgot to mention, if you for whatever reason still need to use COM and OLE (yes they belong together) have a look at the Perl Dev Kit


    holli, /regexed monk/
Re: COM Objects and the need to know more
by apl (Monsignor) on Apr 21, 2008 at 14:24 UTC
    I couldn't immediately find anything in CPAN that looked like it would help.

    If you're not talking about large volumes of data, I'd propose a dinosaur solution: create a CSV file and ship that back and forth.

Re: COM Objects and the need to know more
by jdporter (Paladin) on Apr 21, 2008 at 15:16 UTC
    I haven't tried this, but the Win32::OLE documentation of the new method says:
    To create an object via DCOM on a remote server you can use an array reference in place of PROGID. The referenced array must contain the machine name and the program id or class id. For example:
    my $obj = Win32::OLE->new(['my.machine.com', 'Program.Id'] +);
    A word spoken in Mind will reach its own level, in the objective world, by its own weight
Re: COM Objects and the need to know more
by astroboy (Chaplain) on Apr 22, 2008 at 00:13 UTC
    As mentioned above, you could probably use DBD::Xbase to talk to your Foxpro app on your Windows server. You could then use DBD::Proxy to talk to Foxpro from your Linux box.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://681923]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-24 05:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found