RMI::ProxyReference - used internally by RMI to tie references
This document describes RMI::ProxyReference v0.10.
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.
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, all 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
See general bugs in RMI for general system limitations
RMI RMI::ProxyObject RMI::Node RMI::Client RMI::Server
Tie::Scalar Tie::Array Tie::Hash Tie::Handle
Scott Smith <email@example.com>
Copyright (c) 2008 - 2009 Scott Smith <firstname.lastname@example.org> All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.