diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-02-24 11:13:25 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-02-24 11:13:25 +0200 |
commit | d9bdc9cfcb2f10ea3642b6150e1c4fddbf9facdb (patch) | |
tree | e8fc51d793af7b0b15ca3428a206d22544f82e4a | |
parent | 8147f2b3c96bc6b387f0aa5a7d195de233215484 (diff) | |
download | apache-defaults-d9bdc9cfcb2f10ea3642b6150e1c4fddbf9facdb.tar.gz apache-defaults-d9bdc9cfcb2f10ea3642b6150e1c4fddbf9facdb.tar.bz2 |
Update docs
-rw-r--r-- | Changes | 3 | ||||
-rw-r--r-- | lib/Apache/Defaults.pm | 35 |
2 files changed, 27 insertions, 11 deletions
@@ -0,0 +1,3 @@ +1.00 2018-02-24 + +* Initial release. diff --git a/lib/Apache/Defaults.pm b/lib/Apache/Defaults.pm index b980333..70d5385 100644 --- a/lib/Apache/Defaults.pm +++ b/lib/Apache/Defaults.pm @@ -6,13 +6,13 @@ use IPC::Open3; use Shell::GetEnv; use DateTime::Format::Strptime; use Text::ParseWords; use Symbol 'gensym'; use Carp; -our $VERSION = '0.10'; +our $VERSION = '1.00'; sub new { my $class = shift; my $self = bless { on_error => 'croak' }, $class; local %_ = @_; my $v; @@ -173,12 +173,21 @@ my @ATTRIBUTES = qw(status error *{ __PACKAGE__ . '::' . $attribute } = sub { shift->{$attribute} } } } sub server_root { shift->defines('HTTPD_ROOT') } +sub server_config { + my $self = shift; + my $conf = $self->defines('SERVER_CONFIG_FILE'); + if ($conf && !File::Spec->file_name_is_absolute($conf)) { + $conf = File::Spec->catfile($self->server_root, $conf); + } + return $conf; +} + sub defines { my $self = shift; if (@_) { return @{$self->{defines}}{@_}; } return sort keys %{$self->{defines}}; @@ -336,12 +345,13 @@ Apache::Defaults - Get default settings for Apache httpd daemon =head1 SYNOPSIS $x = new Apache::Defaults; print $x->name; print $x->version; print $x->server_root; + print $x->server_config; print $x->built; print $x->architecture; print $x->MPM; print $x->defines('DYNAMIC_MODULE_LIMIT'); print $x->preloaded('cgi_module'); @@ -374,19 +384,19 @@ The default used in the absense of this attribute is: [ '/usr/sbin/httpd', '/usr/sbin/apache2' ] =item C<environ> Name of the shell script that sets the environment for B<httpd> invocation. -For some obscure reason, B<httpd> attempts to read its configuration file -even if invoked with the B<-V> option (which is intended to print the version -and build parameters of the daemon). It will fail if its configuration refers -to the environment variables, defined elsewhere. This situation is quite -common in Debian-based distributions, which define the environment variables -in file F</etc/apache2/envvars>. This attribute is intended to cope with -such problems, e.g.: + +If invoked with the B<-V> option, B<httpd> attempts to read its configuration +file and will fail if the latter contains references to the environment +variables defined elsewhere. This is quite common in Debian-based +distributions, which define the environment variables in file +F</etc/apache2/envvars>. To avoid such failures, use the C<environ> attribute, +e.g.: $x = new Apache::Defaults(environ => /etc/apache2/envvars) =item C<on_error> Controls the error handling. Allowed values are C<croak> and C<return>. @@ -394,15 +404,12 @@ If the value is C<croak> (the default), the method will I<croak> if an error occurs. If set to C<return>, the constructor will return a valid object. The B<httpd> exit status and diagnostics emitted to the stderr will be available via the B<status> and B<error> methods. =back -The method will I<croak> if an error occurs (e.g. the server binary -is not found or exits with failure). - =head2 status $x = new Apache::Defaults(on_error => 'return'); if ($x->status) { die $x->error; } @@ -427,12 +434,18 @@ Returns the pathname of the B<httpd> binary. =head2 server_command @cmd = $x->server_command; Returns the full command line of the B<httpd> binary. +=head2 server_config + + $s = $x->server_config; + +Returns the full pathname of the server configuration file. + =head2 environ $hashref = $x->environ; Returns a reference to the environment used when invoking the server. |