Apache-Defaults
view release on metacpan or search on metacpan
lib/Apache/Defaults.pm view on Meta::CPAN
$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');
=head1 DESCRIPTION
Detects the default settings of the Apache httpd daemon by invoking
it with appropriate options and analyzing its output.
=head1 METHODS
=head2 new
$x = new Apache::Defaults(%attrs);
Detects the settings of the apache server and returns the object representing
them. Attributes (I<%attrs>) are:
=over 4
=item C<server>
Full pathname of the B<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 B<apachectl> is preferred over directly invoking B<httpd> daemon,
because the apache configuration file might contain referenmces to environment
variables defined elsewhere, which will cause B<httpd> to fail. B<apachectl>
takes care of this by including the file with variable definitions prior to
calling B<httpd>. See also C<environ>, below.
=item C<environ>
Name of the shell script that sets the environment for B<httpd> invocation.
Usually, this is the same script that is sourced by B<apachectl> prior to
passing control over to B<httpd>. This option provides another solution to
the environment problem mentioned above. E.g.:
$x = new Apache::Defaults(environ => /etc/apache2/envvars)
=item C<on_error>
Controls error handling. Allowed values are C<croak> and C<return>.
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
=head2 status
$x = new Apache::Defaults(on_error => 'return');
if ($x->status) {
die $x->error;
}
Returns the status of the last B<httpd> invocation (i.e. the value of
the B<$?> perl variable after B<waitpid>). The caller should inspect
this value, after constructing an B<Apache::Defaults> object with
the C<on_error> attribute set to C<return>.
=head2 error
Returns additional diagnostics if B<$x-E<gt>status != 0>. Normally, these are
diagnostic messages that B<httpd> printed to standard error before
termination.
=head2 server
$s = $x->server;
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.
=head2 name
$s = $x->name;
Returns server implementation name (normally C<Apache>).
=head2 version
$v = $x->version;
Returns server version (as string).
=head2 platform
( run in 2.308 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )