Apache::Defaults - Get default settings for Apache httpd daemon
$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');
Detects the default settings of the Apache httpd daemon by invoking it with appropriate options and analyzing its output.
$x = new Apache::Defaults(%attrs);
Detects the settings of the apache server and returns the object representing them. Attributes (%attrs) are:
server
Full pathname of the httpd binary to inspect. The argument can also be a reference to the list of possible pathnames. In this case, the first of them that exists on disk and has executable privileges will be used. Full command line can also be used, e.g.:
server => '/usr/sbin/httpd -d /etc/httpd'
The default used in the absense of this attribute is:
[ '/usr/sbin/apachectl', '/usr/sbin/httpd', '/usr/sbin/apache2' ]
The use of apachectl is preferred over directly invoking httpd daemon, because the apache configuration file might contain referenmces to environment variables defined elsewhere, which will cause httpd to fail. apachectl takes care of this by including the file with variable definitions prior to calling httpd. See also environ, below.
environ
Name of the shell script that sets the environment for httpd invocation. Usually, this is the same script that is sourced by apachectl prior to passing control over to httpd. This option provides another solution to the environment problem mentioned above. E.g.:
$x = new Apache::Defaults(environ => /etc/apache2/envvars)
on_error
Controls error handling. Allowed values are croak and return. If the value is croak (the default), the method will croak if an error occurs. If set to return, the constructor will return a valid object. The httpd exit status and diagnostics emitted to the stderr will be available via the status and error methods.
croak
return
$x = new Apache::Defaults(on_error => 'return'); if ($x->status) { die $x->error; }
Returns the status of the last httpd invocation (i.e. the value of the $? perl variable after waitpid). The caller should inspect this value, after constructing an Apache::Defaults object with the on_error attribute set to return.
Returns additional diagnostics if $x->status != 0. Normally, these are diagnostic messages that httpd printed to standard error before termination.
$s = $x->server;
Returns the pathname of the httpd binary.
@cmd = $x->server_command;
Returns the full command line of the httpd binary.
$s = $x->server_config;
Returns the full pathname of the server configuration file.
$hashref = $x->environ;
Returns a reference to the environment used when invoking the server.
$s = $x->name;
Returns server implementation name (normally Apache).
Apache
$v = $x->version;
Returns server version (as string).
$s = $x->platform;
Platform (distribution) on which the binary is compiled.
Architecture for which the server is built.
$d = $x->built;
Returns a DateTime object, representing the time when the server was built.
APR tools with which the server is loaded.
APR tools with which the server is compiled.
MPM module loaded in the configuration.
True if the MPM is threaded.
True if the MPM is forked.
@names = $x->defines;
Returns the list of symbolic names defined during the compilation. The names are in lexical order.
@values = $x->defines(@names);
Returns values of the named defines.
$s = $x->server_root;
Returns default server root directory. This is equivalent to
$x->defines('HTTPD_ROOT');
@ids = $x->preloaded;
Returns the list of the preloaded module identifiers, in lexical order.
@sources = $x->preloaded(@ids);
Returns the list of module source names for the given source identifiers. For non-existing identifiers, undef is returned.
GPLv3+: GNU GPL version 3 or later, see http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Sergey Poznyakoff <gray@gnu.org>
To install Apache::Defaults, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::Defaults
CPAN shell
perl -MCPAN -e shell install Apache::Defaults
For more information on module installation, please visit the detailed CPAN module installation guide.