Subject: | Doc error: error_log does not default if log_dir defined |
Hi
See attached local.application.pl.
error_log is commented out, but:
Attribute (error_log) does not pass the type constraint because:
Validation failed for 'Str' with value undef at reader
Server::Control::error_log (defined at
/home/ron/perl5/perlbrew/perls/perl-
5.14.2/lib/site_perl/5.14.2/Server/Control.pm line 51) line 15
Subject: | local.application.pl |
#!/usr/bin/env perl
use feature qw/say switch/;
use strict;
use warnings;
use File::Path 'make_path';
use Path::Class; # For dir(), file().
use Server::Control::Starman;
# ---------------------------
my($action) = shift || '';
my($app_path) = file($ENV{HOME}, 'perl.modules', 'Local-Application', 'httpd', 'cgi-bin', 'local', 'app.psgi');
my($base_dir_name) = '/tmp';
my($binary_path) = file($ENV{HOME}, 'perl5', 'perlbrew', 'perls', 'perl-5.14.2', 'bin', 'starman');
my($app_dir_name) = dir($base_dir_name, 'local.application');
my($log_dir_name) = dir($app_dir_name, 'logs');
my($error_file_name) = dir($log_dir_name, 'error_log');
my($pid_file_name) = dir($app_dir_name, 'pid_file');
make_path("$app_dir_name");
my($server) = Server::Control::Starman -> new
(
app_psgi => "$app_path",
binary_path => "$binary_path",
bind_addr => '127.0.0.1',
# error_log => "$error_file_name",
log_dir => "$log_dir_name",
name => 'Local::Application',
options =>
{
listen => '127.0.0.1:5002',
pid => "$pid_file_name",
workers => 1,
},
pid_file => "$pid_file_name",
port => 5002,
server_root => "$app_dir_name",
wait_for_status_secs => 2,
);
# Report old status.
say 'Status: ', $server -> status_as_string;
my($status) = $server -> status;
given ($status)
{
when (Server::Control::ACTIVE)
{
if ($action eq 'stop')
{
say 'Stopping';
$server -> stop;
}
}
when (Server::Control::INACTIVE)
{
if ($action eq 'start')
{
say 'Starting';
$server -> start;
}
}
when (Server::Control::LISTENING)
{
if ($action eq 'start')
{
say 'Starting';
$server -> start;
}
}
when (Server::Control::RUNNING)
{
if ($action eq 'stop')
{
say 'Stopping';
$server -> stop;
}
}
}
# Report new status if there was an action.
say 'Status: ', $server -> status_as_string if ($action);