| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package RPC::Simple::AnyWhere; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 6 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 41 |  | 
| 4 | 1 |  |  | 1 |  | 6 | use Carp ; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 77 |  | 
| 5 | 1 |  |  | 1 |  | 6 | use vars qw($VERSION $AUTOLOAD @RPC_SUB %_RPC_SUBS); | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 446 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | # Items to export into callers namespace by default. Note: do not export | 
| 8 |  |  |  |  |  |  | # names by default without a very good reason. Use EXPORT_OK instead. | 
| 9 |  |  |  |  |  |  | # Do not simply export all your public functions/methods/constants. | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | ( $VERSION ) = '$Revision: 1.6 $ ' =~ /\$Revision:\s+([^\s]+)/; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | # Preloaded methods go here. | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | # We may need a mechanism to declare the functions vailable on the remote | 
| 16 |  |  |  |  |  |  | # side | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | sub _searchSubs | 
| 19 |  |  |  |  |  |  | { | 
| 20 | 3 |  |  | 3 |  | 5 | my $self = shift ; | 
| 21 | 3 |  |  |  |  | 5 | my $package = shift ; | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 3 |  |  |  |  | 7 | push @{$_RPC_SUBS{ref($self)}}, eval("\@${package}::RPC_SUB") ; | 
|  | 3 |  |  |  |  | 378 |  | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 3 |  |  |  |  | 155 | foreach my $class (eval("\@${package}::ISA")) | 
| 26 |  |  |  |  |  |  | { | 
| 27 | 2 |  |  |  |  | 8 | $self->_searchSubs($class) ; | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | sub AUTOLOAD | 
| 32 |  |  |  |  |  |  | { | 
| 33 | 1 |  |  | 1 |  | 527 | my $self = shift ; | 
| 34 |  |  |  |  |  |  |  | 
| 35 | 1 |  |  |  |  | 2 | my $called = $AUTOLOAD ; | 
| 36 | 1 |  |  |  |  | 20 | $called =~ s/.*::// ; | 
| 37 |  |  |  |  |  |  |  | 
| 38 | 1 | 50 | 50 |  |  | 14 | if (defined $_RPC_SUBS{ref($self)} and | 
|  | 1 |  |  |  |  | 7 |  | 
| 39 |  |  |  |  |  |  | scalar grep ($called eq $_,@{$_RPC_SUBS{ref($self)}} )) | 
| 40 |  |  |  |  |  |  | { | 
| 41 | 1 |  |  |  |  | 7 | $self->{_twinHandle}->delegate($called,@_) ; | 
| 42 | 1 |  |  |  |  | 3 | return $self ; | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 | 0 |  |  |  |  |  | croak "Undefined subroutine $AUTOLOAD called"; | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | sub DESTROY | 
| 49 |  |  |  |  |  |  | { | 
| 50 | 0 |  |  | 0 |  |  | my $self = shift ; | 
| 51 | 0 |  |  |  |  |  | print "class ",ref($self)," destroyed \n"; | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | # Autoload methods go after =cut, and are processed by the autosplit program. | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | 1; | 
| 57 |  |  |  |  |  |  | __END__ |