RPC::Serialized::Server::NetServer::SSL - Run an RPC server using IO::Socket::SSL
version 1.123630
use RPC::Serialized::Server::NetServer::SSL; my $s = RPC::Serialized::Server::NetServer::SSL->new({ net_server => { port => 1234 }, }); # note that $s isa Net::Server::PreFork, not an RPC::Serialized s->run; # server process is now looping and waiting for RPC (like Apache prefork) # the default port number for Net::Server is 20203 # alternatively, if you have an external configuration file which # Config::Any can load, try the following: $s = RPC::Serialized::Server::NetServer::SSL->new('/path/to/config/file'); # you can also combine config file and hash reference arguments
This module provides a bridge between RPC::Serialized and Net::Server, meaning you can easily run an RPC server without installing any additional daemonizing tools onto your system. The module sets up a basic PreFork server, which runs much like Apache in PreFork mode, and you can override any of the default configuration to Net::Server.
Net::Server
The module uses a Secure Socket Layer (SSL) to encapsulate the normal operation, which is otherwise identical to that of the RPC::Serialized::Server::NetServer module.
It is strongly recommended that you at least once read through the Net::Server manual page and the Net::Server::PreFork manual page, to familiarize yourself with the configuration options. You do not need to worry much about the client connection processing or hooks, because that is dealt with inside of this module.
In addition to the normal Net::Server parameters, any of the SSL parameters from IO::Socket::SSL may also be specified in the net_server config hash.
net_server
Most of the defaults for Net::Server have been left alone, because they are reasonably sane and easy to override using the syntax shown in "SYOPSIS", above. Here are the non-standard settings:
log_level
4
This means you get a little more detail from the parent Net::Server process about its child handlers, for instance when they are started.
syslog_facility
local1
This is merely so that logging messages from this application are available separately to your other standard system logs. Most good Syslog daemons (e.g. syslog-ng can flexibly handle each facility.
syslog-ng
By default the server will remain in the foreground, and not fork or detach from its parent process to become a daemon. Check the background and setsid options if you would like a proper background daemon running.
background
setsid
The logging output will go to STDERR, so to change this set the log_file option. The Net::Server manual page describes the values available.
log_file
For performance tweaking, you might want to alter some of the Net::Server::PreFork settings. Again, see the manual page for that module for further details.
Net::Server::PreFork
Once you have instantiated a new server object using new(), there is just one method call to make to begin the processing loop:
new()
$s->run;
This will fork the child handlers, and begin running as a server. Note that this is a method on the Net::Server object and not RPC::Serialized; it wraps the process() call normally issued to that module in other servers.
RPC::Serialized
process()
Kindly submitted by Oleg A. Mamontov.
Oliver Gorwits <oliver@cpan.org>
This software is copyright (c) 2012 by University of Oxford.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install RPC::Serialized, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RPC::Serialized
CPAN shell
perl -MCPAN -e shell install RPC::Serialized
For more information on module installation, please visit the detailed CPAN module installation guide.