Constants(3) User Contributed Perl Documentation Constants(3)
NAME
Apache::Constants - Constants defined in apache header files
SYNOPSIS
use Apache::Constants;
use Apache::Constants ':common';
use Apache::Constants ':response';
DESCRIPTION
Server constants used by apache modules are defined in httpd.h and other header files, this module
gives Perl access to those constants.
EXPORT TAGS
common
This tag imports the most commonly used constants.
OK
DECLINED
DONE
NOT_FOUND
FORBIDDEN
AUTH_REQUIRED
SERVER_ERROR
response
This tag imports the common response codes, plus these response codes:
DOCUMENT_FOLLOWS
MOVED
REDIRECT
USE_LOCAL_COPY
BAD_REQUEST
BAD_GATEWAY
RESPONSE_CODES
NOT_IMPLEMENTED
CONTINUE
NOT_AUTHORITATIVE
CONTINUE and NOT_AUTHORITATIVE are aliases for DECLINED.
methods
This are the method numbers, commonly used with the Apache method_number method.
METHODS
M_CONNECT
M_DELETE
M_GET
M_INVALID
M_OPTIONS
M_POST
M_PUT
M_TRACE
M_PATCH
M_PROPFIND
M_PROPPATCH
M_MKCOL
M_COPY
M_MOVE
M_LOCK
M_UNLOCK
options
These constants are most commonly used with the Apache allow_options method:
OPT_NONE
OPT_INDEXES
OPT_INCLUDES
OPT_SYM_LINKS
OPT_EXECCGI
OPT_UNSET
OPT_INCNOEXEC
OPT_SYM_OWNER
OPT_MULTI
OPT_ALL
satisfy
These constants are most commonly used with the Apache satisfies method:
SATISFY_ALL
SATISFY_ANY
SATISFY_NOSPEC
remotehost
These constants are most commonly used with the Apache get_remote_host method:
REMOTE_HOST
REMOTE_NAME
REMOTE_NOLOOKUP
REMOTE_DOUBLE_REV
http
This is the full set of HTTP response codes: (NOTE: not all implemented here)
HTTP_OK
HTTP_MOVED_TEMPORARILY
HTTP_MOVED_PERMANENTLY
HTTP_METHOD_NOT_ALLOWED
HTTP_NOT_MODIFIED
HTTP_UNAUTHORIZED
HTTP_FORBIDDEN
HTTP_NOT_FOUND
HTTP_BAD_REQUEST
HTTP_INTERNAL_SERVER_ERROR
HTTP_NOT_ACCEPTABLE
HTTP_NO_CONTENT
HTTP_PRECONDITION_FAILED
HTTP_SERVICE_UNAVAILABLE
HTTP_VARIANT_ALSO_VARIES
server
These are constants related to server version:
MODULE_MAGIC_NUMBER
SERVER_VERSION
SERVER_BUILT
config
These are constants related to configuration directives:
DECLINE_CMD
types
These are constants related to internal request types:
DIR_MAGIC_TYPE
override
These constants are used to control and test the context of configuration directives.
OR_NONE
OR_LIMIT
OR_OPTIONS
OR_FILEINFO
OR_AUTHCFG
OR_INDEXES
OR_UNSET
OR_ALL
ACCESS_CONF
RSRC_CONF
args_how
RAW_ARGS
TAKE1
TAKE2
TAKE12
TAKE3
TAKE23
TAKE123
ITERATE
ITERATE2
FLAG
NO_ARGS
Misuses
You should be aware of the issues relating to using constant subroutines in Perl. For example this:
$r->custom_response(FORBIDDEN => "File size exceeds quota.");
will not set a custom response for "FORBIDDEN", but for the string "FORBIDDEN", which clearly isn't
what is expected. You'll get an error like this:
[Tue Apr 23 19:46:14 2002] null: Argument "FORBIDDEN" isn't
numeric in subroutine entry at ...
Therefore, the best solution is not to use the hash notation for things that don't require it:
$r->custom_response(FORBIDDEN, "File size exceeds quota.");
Another important note is that instead of using HTTP codes, you should use designed for that purpose
constants. Therefore, this is wrong:
sub handler { return 200; }
The correct use is:
use Apache::Constants qw(OK);
sub handler { return OK; }
Also remember that "OK != HTTP_OK".
AUTHORS
Doug MacEachern, Gisle Aas and h2xs
perl v5.8.8 2003-10-08 Constants(3)
|