Sprocket::Server - The Sprocket Server
use Sprocket qw( Server ); Sprocket::Server->spawn( Name => 'Test Server', # Optional, defaults to Server ListenAddress => '127.0.0.1', # Optional, defaults to INADDR_ANY ListenPort => 9979, # Optional, defaults to 0 (random port) Domain => AF_INET, # Optional, defaults to AF_INET Reuse => 'yes', # Optional, defaults to yes Plugins => [ { plugin => MyPlugin->new(), priority => 0, # default }, ], LogLevel => 4, MaxConnections => 10000, );
Sprocket::Server defines a TCP/IP Server, it binds to a Address and Port and listens for incoming TCP/IP connections.
Create a new Sprocket::Server object.
The Name for this server. This is used for logging. It is optional and defaults to 'Server'
The port this server listens on.
The address this server listens on.
The domain type for the socket. Defaults to AF_INET. For UNIX sockets, see Sprocket::Server::UNIX
The minimum level of logging, defaults to 4
Sprocket::Logger::Basic is the default and logs to STDERR. The object must support put( $server, { v => $level, msg => $msg } ) or wrap a logging system using this format. See also Sprocket::Logger::Log4perl
Sprocket will set the rlimit to this value using BSD::Resource
Plugins that this server will hand off processing to. In an array ref of hash ref's format as so:
{ plugin => MyPlugin->new(), priority => 0 # default }
Shutdown this server. If $type is 'soft' then a soft shutdown procedure will begin. local_shutdown will be called for each connection.
The name of the server, specified during spawn.
Session id of the controlling poe session.
UUID of the server, generated during spawn.
returns the shutdown type, ie. 'soft' if shutting down, otherwize, undef.
returns the number of connections
returns the logger object.
returns a hash ref of the options passed to spawn
true if the server is pre-forked
true if this instance is a forked process. You can determine if you're in the parent process if is_child is false and is_forked is true.
See Sprocket for observer hook semantics.
These events are handled by plugins. See Sprocket::Plugin.
POE, Sprocket, Sprocket::Connection, Sprocket::Plugin, Sprocket::Client, Sprocket::Server::PreFork, Sprocket::Server::UNIX, Sprocket::Logger::Basic, Sprocket::Logger::Log4perl
David Davis <xantus@cpan.org>
Please rate this module. http://cpanratings.perl.org/rate/?distribution=Sprocket
Copyright 2006-2007 by David Davis
See Sprocket for license information.
To install Sprocket, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sprocket
CPAN shell
perl -MCPAN -e shell install Sprocket
For more information on module installation, please visit the detailed CPAN module installation guide.