http://qs1969.pair.com?node_id=133137


in reply to Re: Tying variables to remote objects
in thread Tying variables to remote objects

Cool idea! I don't see a reason why it can't be done. I've had some ideas of tying variables to CORBA objects. It would certainly make the CORBA interfaces much simpler, and would really give stuff like EJB a run for it's money.

I think this concept could not only be used for SOAP or CORBA but also for POE. You'd need to do some serious planning and design to get this to work, but I'm sure it's feasible.

-- Brett

Go not to the Elves for counsel, for they will say both no and yes

  • Comment on Re: Re: Tying variables to remote objects

Replies are listed 'Best First'.
Tying variables to remote CORBA objects
by djantzen (Priest) on Dec 20, 2001 at 05:37 UTC

    Oooo, This does raise some interesting options. Not long ago I was writing a CORBA system with Perl on the server and a Java client. Of course there are hashes all over on the server since the API is in Perl, but hashes aren't a basic type in Java, and they sure aren't in OMG IDL. My simple solution was to map hashes to multidimensional arrays in IDL, but then the client has to do a lot of nitpicking array handling (esp. since it's Java :P )

    A better idea might be a general IDL interface defining a set of hash functions. But on the server side it wouldn't work to tie the hash to the 'CORBAHash' b/c the tied hashes are just proxy objects, and the remote reference used by the client will necessarily point to the instance of CORBAHash, not the tied hash. So, on the server side, the CORBAHash would have to be a wrapper class around the hash with the data you want.

    What would be nice is to reverse the tie(), so that you could tie an instance of a class to a populated data structure, as in:

    tie($corba_hash, %$hash); return $corba_hash; # return to the client
    But then you might as well just pass the hash into the constructor of the remote implementation class. So, I think what you'd want is:
    bless($hash, 'CORBAHash'); $ORB->activate($hash); # register object with the ORB return $hash; # return to the client
    If the client were in Perl, you'd want to be able to say:
    tie(%hash, 'CORBAHash');
    To make this work I think you'd have to write the TIEHASH method to call a remote factory method, since the whole point is to tie the hash to a remote object. The factory method produces a remote object reference with the hash interface, and then it's just a matter of the local Perl interpreter to link the hash reference to the remote reference.

    Update: I'm using the COPE language binding for Perl.

      I'll ask the obvious question: How are you implementing CORBA servers in Perl?