File Coverage

blib/lib/RPC/Simple/AnyLocal.pm
Criterion Covered Total %
statement 21 25 84.0
branch 2 4 50.0
condition n/a
subroutine 5 6 83.3
pod 2 2 100.0
total 30 37 81.0


line stmt bran cond sub pod time code
1             package RPC::Simple::AnyLocal;
2              
3 1     1   13 use strict;
  1         3  
  1         39  
4              
5 1     1   7 use vars qw(@ISA $VERSION %_RPC_SUBS);
  1         2  
  1         54  
6              
7 1     1   540 use RPC::Simple::Agent ;
  1         4  
  1         39  
8 1     1   880 use RPC::Simple::AnyWhere ;
  1         3  
  1         278  
9              
10             # Items to export into callers namespace by default. Note: do not export
11             # names by default without a very good reason. Use EXPORT_OK instead.
12             # Do not simply export all your public functions/methods/constants.
13              
14             ( $VERSION ) = '$Revision: 1.8 $ ' =~ /\$Revision:\s+([^\s]+)/;
15              
16             @ISA = qw(RPC::Simple::AnyWhere) ;
17             *_RPC_SUBS=*RPC::Simple::AnyWhere::_RPC_SUBS;
18             # Preloaded methods go here.
19              
20             # We may need a mechanism to declare the functions vailable on the remote
21             # side
22              
23             sub createRemote
24             {
25 1     1 1 556 my $self = shift ;
26 1         2 my $factory = shift ;
27 1         11 my $remoteClass = shift ;
28              
29 1 50       10 die "No factory object given to ",ref($self),"->createRemote\n"
30             unless defined $factory ;
31              
32             # construct an array of existing remote functions and store it in the
33             # child class name space (rude but necessary behavior)
34 1 50       6 unless (defined $_RPC_SUBS{ref($self)})
35             {
36 1         40 $self->_searchSubs(ref($self)) ;
37             }
38              
39             # create real process object
40 1         14 $self->{_twinHandle} =
41             $factory->newRemoteObject($self, $remoteClass, @_ ) ;
42            
43 1         14 $self->{remoteHostName} = $self->{_twinHandle}->getRemoteHostName() ;
44              
45 1         3 return $self ;
46             }
47              
48             sub destroy
49             {
50 0     0 1   my $self = shift ;
51 0           print "AnyLocal object destroyed\n" ;
52 0           $self->{_twinHandle}->destroy;
53 0           undef $self->{_twinHandle} ;
54             }
55              
56             # Autoload methods go after =cut, and are processed by the autosplit program.
57              
58             1;
59             __END__