=head1 NAME Apache::ServerUtil -- Methods for work with Apache::Server object =head1 SYNOPSIS use Apache::ServerUtil; $s = Apache->server; my $srv_cfg = $s->dir_config; # get 'conf/' dir path using $r my $conf_dir = Apache::server_root_relative('conf', $r->pool); # get 'log/' dir path using default server startup pool my $log_dir = Apache::server_root_relative('log'); =head1 DESCRIPTION C provides the Perl API for Apache server object. META: complete =head1 API Function arguments (if any) and return values are shown in the function's synopsis. =head2 CONSTANTS =over =item * server_root returns the value set by the C directive. =back =head2 FUNCTIONS =over =item * server_root_relative() Returns the canonical form of the filename made absolute to C: Apache::server_root_relative($pool, $fname); C<$fname> is appended to the value of C and return it. e.g.: my $log_dir = Apache::server_root_relative($r->pool, 'logs'); If C<$fname> is not specified, the value of C is returned with a trailing C. (it's the same as using C<''> as C<$fname>'s value). Also see the C constant. =back =head2 METHODS =over =item * server() The main server's object can be retrieved with: $s = Apache->server; Gets the C object for the main server. =item * dir_config() dir_config() provides an interface for the per-server variables specified by the C and C directives, and also can be manipulated via the C methods. The keys are case-insensitive. $t = $s->dir_config(); dir_config() called in a scalar context without the C<$key> argument returns a I reference blessed into the I class. This object can be manipulated via the I methods. For available methods see I. @values = $s->dir_config($key); If the C<$key> argument is passed in the list context a list of all matching values will be returned. This method is ineffective for big tables, as it does a linear search of the table. Thefore avoid using this way of calling dir_config() unless you know that there could be more than one value for the wanted key and all the values are wanted. $value = $s->dir_config($key); If the C<$key> argument is passed in the scalar context only a single value will be returned. Since the table preserves the insertion order, if there is more than one value for the same key, the oldest value assosiated with the desired key is returned. Calling in the scalar context is also much faster, as it'll stop searching the table as soon as the first match happens. $s->dir_config($key => $val); If the C<$key> and the C<$val> arguments are used, the set() operation will happen: all existing values associated with the key C<$key> (and the key itself) will be deleted and C<$value> will be placed instead. $s->dir_config($key => undef); If C<$val> is I the unset() operation will happen: all existing values associated with the key C<$key> (and the key itself) will be deleted. =item * push_handlers() $s->push_handlers(PerlResponseHandler => \&handler); $s->push_handlers(PerlResponseHandler => [\&handler, \&handler2]); # XXX: not implemented yet $s->push_handlers(PerlResponseHandler => sub {...}); =item * add_handlers() =item * get_handlers() =back =cut