Perinci-Access-Simple-Server
view release on metacpan or search on metacpan
lib/Perinci/Access/Simple/Server/Socket.pm view on Meta::CPAN
=head2 ports => ARRAY OF STR (default [])
One or more TCP ports to listen to. Default is none. Each port can be in the
form of N, ":N", "0.0.0.0:N" (all means the same thing, to bind to all
interfaces) or "1.2.3.4:N" (to bind to a specific network interface).
A string is also accepted, it will be split (delimiter ,) beforehand.
Since server does not support any encryption, it is recommended to bind to
localhost (127.0.0.1).
=head2 unix_sockets => ARRAY OF STR (default [])
Location of Unix sockets. Default is none, which means not listening to Unix
socket. Each element should be an absolute path.
A string is also accepted, it will be split (delimiter ,) beforehand.
You must at least specify one port or one Unix socket, or server will refuse to
run.
=head2 timeout => BOOL (default 120)
Socket timeout. Will be passed to IO::Socket.
=head2 require_root => BOOL (default 0)
Whether to require running as root.
Passed to L<Proc::Daemon::Prefork>'s constructor.
=head2 pid_path => STR (default /var/run/<name>.pid or ~/<name>.pid)
Location of PID file.
=head2 scoreboard_path => STR (default /var/run/<name>.scoreboard or ~/<name>.scoreboard)
Location of scoreboard file (used for communication between parent and child
processes). If you disable this (by setting scoreboard_path => 0), autoadjusting
number of children won't work (number of children will be kept at
'start_servers').
=head2 error_log_path => STR (default /var/log/<name>-error.log or ~/<name>-error.log)
Location of error log. Default is /var/log/<name>-error.log. It will be opened
in append mode.
=head2 access_log_path => STR (default /var/log/<name>-access.log or ~/<name>-access.log)
Location of access log. It will be opened in append mode.
=head2 start_servers => INT (default 3)
Number of children to fork at the start of run. If you set this to 0, the server
becomes a nonforking one.
Tip: You can set start_servers to 0 and 'daemonize' to false for debugging.
=head2 max_clients => INT (default 150)
Maximum number of children processes to maintain. If server is busy, number of
children will be increased from the original 'start_servers' up until this
value.
=head2 max_requests_per_child => INT (default 1000)
Number of requests each child will serve until it exists.
=head1 METHODS
=for Pod::Coverage BUILD
=head2 $server = Perinci::Access::Simple::Server::Socket->new(%args)
Create a new instance of server. %args can be used to set attributes.
=head2 $server->run()
Run server.
=head2 $server->start()
Alias for run().
=head2 $server->stop()
Stop running server.
=head2 $server->restart()
Restart server.
=head2 $server->is_running() => BOOL
Check whether server is running.
=head2 $server->before_prefork()
This is a hook provided for subclasses to do something before the daemon is
preforking. For example, you can preload Perl modules here so that each child
doesn't have to load modules separately (= inefficient).
=head2 $server->access_log($sock)
Write access log entry.
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/Perinci-Access-Simple-Server>.
=head1 SOURCE
Source repository is at L<https://github.com/perlancar/perl-Perinci-Access-Simple-Server>.
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-Access-Simple-Server>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
( run in 0.529 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )