NAME

RMI::ProxyReference - used internally by RMI::Node to tie references

DESCRIPTION

When an refrerence is detected in the params or return value for an RMI call, the sending RMI::Node (client sending params or server sending results) captures a reference to the item internally, generates an "id" for that object, and sends the "id" across the handle instead.

When the remote side recieves the "id", it also recieves an indication that this is the id of a proxied reference, an indication of what Perl base type it is (SCALAR,ARRAY,HASH,CODE,GLOB/IO), and what class it is blessed-into, if any. The remote side constructs a reference of the appropriate type, and uses "tie" to bind it to this package.

All subsequent attempst to use the reference fire AUTOLOAD, and result in a request across the "wire" to the other side.

Note: if the reference is blessed, it also blesses the object as an RMI::ProxyObject. Because bless and tie are independent, a single reference can (and will) be blessed and tied to two different packages, one for method call resolution, and one for usage of the reference as a HASH ref, ARRAY ref, CODE ref, etc.

Details of Perl tie are somewhat esoteric, but it is worth mentioning that tying a reference $o results in an additional, separate object being created, which is the invocant above whenever activity on the reference occurs. That second object is managed internally by Perl, though we are able to use it to store the identify of $o on the "real" side, along with information about the RMI::Node through which to proxy calls.

Note: CODE references are not tied, and do not use this class. A proxy for a code reference is generated as an anonymous subrotine which makes a remote call via its RMI::Node upon execute.

METHODS

The RMI::ProxyReference implements TIEHASH TIEARRAY TIESCALAR and TIEHANDLE with a single implementation. All other methods are implemented by proxying back to the original side via AUTOLOAD.

On the local side, attempts to access the real reference go through Tie::StdArray, Tie::StdHash, Tie::StdScalar and Tie::StdHandle. Note that we do not _actually_ "tie" the real reference on the original side before sending it. These methods work just fine with the

BUGS AND CAVEATS

references tied by RMI::ProxyReference cannot be tied to other things

See general bugs in RMI for general system limitations

this uses Tie::Std* modules in non-standard ways

AUTOLOAD makes a remote function call for every operation to one of the Tie::Std* family of modules. The code for these modules works by beautiful coincidence on the side which originated the reference, even though that reference is not actually tied to that package in that process (nor in the remote process, b/c there it is tied to _this_ package).

It is not known yet whether this has unseen limitations, and we will eventually need custom packages to manage remote operations on references.

SEE ALSO

RMI RMI::ProxyObject RMI::Node RMI::Client RMI::Server

Tie::Scalar Tie::Array Tie::Hash Tie::Handle