File Coverage

blib/lib/RMI/Server.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 25 25 100.0


line stmt bran cond sub pod time code
1             package RMI::Server;
2              
3 24     24   135 use strict;
  24         41  
  24         819  
4 24     24   129 use warnings;
  24         49  
  24         598  
5 24     24   124 use version;
  24         49  
  24         1565  
6             our $VERSION = $RMI::VERSION;
7              
8 24     24   2085 use base 'RMI::Node';
  24         48  
  24         4637  
9              
10             sub run {
11 11     11 1 5035 my($self) = @_;
12 11         89 while(1) {
13 251 100       1218 last if $self->{is_closed};
14 241         2174 $self->receive_request_and_send_response();
15             }
16 10         52 return 1;
17             }
18              
19              
20             1;
21              
22             =pod
23              
24             =head1 NAME
25              
26             RMI::Server - service RMI::Client requests from another process
27              
28             =head1 VERSION
29              
30             This docuement describes RMI::Server v0.10.
31              
32             =head1 SYNOPSIS
33              
34             $s = RMI::Server->new(
35             reader => $fh1,
36             writer => $fh2,
37             );
38             $s->run;
39              
40             $s = RMI::Server::Tcp->new(
41             port => 1234
42             );
43             $s->run;
44              
45             $s = RMI::Server->new(...);
46             for (1..3) {
47             $s->receive_request_and_send_response;
48             }
49            
50             =head1 DESCRIPTION
51              
52             This is the base class for RMI::Servers, which accept requests
53             via an IO handle of some sort, execute code on behalf of the
54             request, and send the return value back to the client.
55              
56             When the RMI::Server responds to a request which returns objects or references,
57             the proxies are constructed in the client (the data behind the object is not serialized).
58              
59             When the client sends objects or other references as parameters, proxies are created on the server
60             to represent those objects. It is possible, even likely, that while the server is
61             executing the requested code using those parameters, that the proxies will be the source of
62             counter-requests, leading to the remote client filling a server role temporarily.
63              
64             See the detailed explanation of remote proxy references in the B general
65             documentation, and see B for details on how any client and server actually
66             fill both roles.
67              
68             =head1 METHODS
69              
70             =head2 new()
71              
72             $s = RMI::Server->new(reader => $fh1, writer => $fh2)
73              
74             This is typically overriden in a specific subclass of RMI::Server to construct
75             the reader and writer according to a particular strategy. It is possible for
76             the reader and the writer to be the same handle, particularly for B.
77              
78             =head2 receive_request_and_send_response()
79              
80             $bool = $
81              
82             Implemented in the base class for all RMI::Node objects, this handles processing
83             a single request from the reader handle.
84              
85             =head2 run()
86              
87             $s->run();
88            
89             Enter a loop processing RMI requests. This will continue as long as the
90             connection is open.
91              
92             =head1 BUGS AND CAVEATS
93              
94             See general bugs in B for general system limitations.
95              
96             =head1 SEE ALSO
97              
98             B B B B B
99              
100             =head1 AUTHORS
101              
102             Scott Smith
103              
104             =head1 COPYRIGHT
105              
106             Copyright (c) 2008 - 2009 Scott Smith All rights reserved.
107              
108             =head1 LICENSE
109              
110             This program is free software; you can redistribute it and/or modify it under
111             the same terms as Perl itself.
112              
113             The full text of the license can be found in the LICENSE file included with this
114             module.
115              
116             =cut