You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs-cvs@perl.apache.org by st...@apache.org on 2001/10/10 07:06:36 UTC
cvs commit: modperl-docs/src/api/mod_perl-2.0/Apache ServerUtil.pod RequestRec.pod
stas 01/10/09 22:06:36
Modified: src/api/mod_perl-2.0/Apache RequestRec.pod
Added: src/api/mod_perl-2.0/Apache ServerUtil.pod
Log:
- documenting $r->server() and Apache->server() methods
Revision Changes Path
1.2 +15 -4 modperl-docs/src/api/mod_perl-2.0/Apache/RequestRec.pod
Index: RequestRec.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/api/mod_perl-2.0/Apache/RequestRec.pod,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RequestRec.pod 2001/10/02 15:00:46 1.1
+++ RequestRec.pod 2001/10/10 05:06:36 1.2
@@ -4,10 +4,14 @@
=head1 SYNOPSIS
- sub handler{
- my $r = shift;
- # now the API can be used on $r
- }
+ use Apache::RequestRec;
+ sub handler{
+ my $r = shift;
+
+ my $s = $r->server;
+ my $dir_config = $r->dir_config;
+ ...
+ }
=head1 DESCRIPTION
@@ -19,6 +23,13 @@
function's synopsis.
=over
+
+=item * server()
+
+ $s = $r->server;
+
+Gets the C<Apache::Server> object for the server the request C<$r> is
+running under.
=item * dir_config()
1.1 modperl-docs/src/api/mod_perl-2.0/Apache/ServerUtil.pod
Index: ServerUtil.pod
===================================================================
=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;
=head1 DESCRIPTION
META: complete
=head1 API
Function arguments (if any) and return values are shown in the
function's synopsis.
=over
=item * server()
The main server's object can be retrieved with:
$s = Apache->server;
Gets the C<Apache::Server> object for the main server.
=item * dir_config()
dir_config() provides an interface for the per-server variables
specified by the C<PerlSetVar> and C<PerlAddVar> directives, and also
can be manipulated via the C<APR::Table> 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<HASH> reference blessed into the I<APR::Table> class. This
object can be manipulated via the I<APR::Table> methods. For available
methods see I<APR::Table>.
@values = $r->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 = $r->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.
$r->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.
$r->dir_config( $key => undef );
If C<$val> is I<undef> the unset() operation will happen: all existing
values associated with the key C<$key> (and the key itself) will be
deleted.
=item * push_handlers()
=item * add_handlers()
=item * get_handlers()
=back
=cut
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org