NAME
Apache::Const - Perl Interface for Apache Constants
Synopsis
# make the constants available but don't import them
use Apache::Const -compile => qw(constant names ...);
# w/o the => syntax sugar
use Apache::Const ("-compile", qw(constant names ...));
# compile and import the constants
use Apache::Const qw(constant names ...);
Description
This package contains constants specific to Apache
features.
mod_perl 2.0 comes with several hundreds of constants, which you don't want to make available to your Perl code by default, due to CPU and memory overhead. Therefore when you want to use a certain constant you need to explicitly ask to make it available.
For example, the code:
use Apache::Const -compile => qw(FORBIDDEN OK);
makes the constants Apache::FORBIDDEN
and Apache::OK
available to your code, but they aren't imported. In which case you need to use a fully qualified constants, as in:
return Apache::OK;
If you drop the argument -compile
and write:
use Apache::Const qw(FORBIDDEN OK);
Then both constants are imported into your code's namespace and can be used standalone like so:
return OK;
Both, due to the extra memory requirement, when importing symbols, and since there are constants in other namespaces (e.g., APR::
and ModPerl::
, and non-mod_perl modules) which may contain the same names, it's not recommended to import constants. I.e. you want to use the -compile
construct.
Finaly, in Perl =>
is almost the same as the comma operator. It can be used as syntax sugar making it more clear when there is a key-value relation between two arguments, and also it automatically parses its lefthand argument (the key) as a string, so you don't need to quote it.
If you don't want to use that syntax, instead of writing:
use Apache::Const -compile => qw(FORBIDDEN OK);
you could write:
use Apache::Const "-compile", qw(FORBIDDEN OK);
and for parentheses-lovers:
use Apache::Const ("-compile", qw(FORBIDDEN OK));
Constants
:cmd_how
use Apache::Const -compile => qw(:cmd_how);
The :cmd_how
constants group is used in @APACHE_MODULE_COMMANDS
and $cmds->args_how
.
Apache::FLAG
One of On or Off (full description).
Apache::ITERATE
One argument, occuring multiple times (full description).
Apache::ITERATE2
Two arguments, the second occurs multiple times (full description).
Apache::NO_ARGS
No arguments at all (full description).
Apache::RAW_ARGS
The command will parse the command line itself (full description).
Apache::TAKE1
One argument only (full description).
Apache::TAKE12
One or two arguments (full description).
Apache::TAKE123
One, two or three arguments (full description).
Apache::TAKE13
One or three arguments (full description).
Apache::TAKE2
Two arguments (full description).
Apache::TAKE23
Two or three arguments (full description).
Apache::TAKE3
Three arguments (full description).
:common
use Apache::Const -compile => qw(:common);
The :common
group is for XXX constants.
Apache::AUTH_REQUIRED
Apache::DECLINED
Apache::DONE
Apache::FORBIDDEN
Apache::NOT_FOUND
Apache::OK
Apache::REDIRECT
Apache::SERVER_ERROR
:config
use Apache::Const -compile => qw(:config);
The :config
group is for XXX constants.
Apache::DECLINE_CMD
:conn_keepalive
use Apache::Const -compile => qw(:conn_keepalive);
The :conn_keepalive
constants group is used by the ($c->keepalive
) method.
Apache::CONN_CLOSE
The connection will be closed at the end of the current HTTP request.
Apache::CONN_KEEPALIVE
The connection will be kept alive at the end of the current HTTP request.
Apache::CONN_UNKNOWN
The connection is at an unknown state, e.g., initialized but not open yet.
:context
use Apache::Const -compile => qw(:context);
The :context
group is used by the $parms->check_cmd_context
method.
Apache::NOT_IN_VIRTUALHOST
The command is not in a <VirtualHost> block.
Apache::NOT_IN_LIMIT
The command is not in a <Limit> block.
Apache::NOT_IN_DIRECTORY
The command is not in a <Directory> block.
Apache::NOT_IN_LOCATION
The command is not in a <Location>/<LocationMatch> block.
Apache::NOT_IN_FILES
The command is not in a <Files>/<FilesMatch> block.
Apache::NOT_IN_DIR_LOC_FILE
The command is not in a <Files>/<FilesMatch>, <Location>/<LocationMatch> or <Directory> block.
Apache::GLOBAL_ONLY
The directive appears outside of any container directives.
:filter_type
use Apache::Const -compile => qw(:filter_type);
The :filter_type
group is for XXX constants.
Apache::FTYPE_CONNECTION
Apache::FTYPE_CONTENT_SET
Apache::FTYPE_NETWORK
Apache::FTYPE_PROTOCOL
Apache::FTYPE_RESOURCE
Apache::FTYPE_TRANSCODE
:http
use Apache::Const -compile => qw(:http);
The :http
group is for XXX constants.
Apache::HTTP_ACCEPTED
Apache::HTTP_BAD_GATEWAY
Apache::HTTP_BAD_REQUEST
Apache::HTTP_CONFLICT
Apache::HTTP_CONTINUE
Apache::HTTP_CREATED
Apache::HTTP_EXPECTATION_FAILED
Apache::HTTP_FAILED_DEPENDENCY
Apache::HTTP_FORBIDDEN
Apache::HTTP_GATEWAY_TIME_OUT
Apache::HTTP_GONE
Apache::HTTP_INSUFFICIENT_STORAGE
Apache::HTTP_INTERNAL_SERVER_ERROR
Apache::HTTP_LENGTH_REQUIRED
Apache::HTTP_LOCKED
Apache::HTTP_METHOD_NOT_ALLOWED
Apache::HTTP_MOVED_PERMANENTLY
Apache::HTTP_MOVED_TEMPORARILY
Apache::HTTP_MULTIPLE_CHOICES
Apache::HTTP_MULTI_STATUS
Apache::HTTP_NON_AUTHORITATIVE
Apache::HTTP_NOT_ACCEPTABLE
Apache::HTTP_NOT_EXTENDED
Apache::HTTP_NOT_FOUND
Apache::HTTP_NOT_IMPLEMENTED
Apache::HTTP_NOT_MODIFIED
Apache::HTTP_NO_CONTENT
Apache::HTTP_OK
Apache::HTTP_PARTIAL_CONTENT
Apache::HTTP_PAYMENT_REQUIRED
Apache::HTTP_PRECONDITION_FAILED
Apache::HTTP_PROCESSING
Apache::HTTP_PROXY_AUTHENTICATION_REQUIRED
Apache::HTTP_RANGE_NOT_SATISFIABLE
Apache::HTTP_REQUEST_ENTITY_TOO_LARGE
Apache::HTTP_REQUEST_TIME_OUT
Apache::HTTP_REQUEST_URI_TOO_LARGE
Apache::HTTP_RESET_CONTENT
Apache::HTTP_SEE_OTHER
Apache::HTTP_SERVICE_UNAVAILABLE
Apache::HTTP_SWITCHING_PROTOCOLS
Apache::HTTP_TEMPORARY_REDIRECT
Apache::HTTP_UNAUTHORIZED
Apache::HTTP_UNPROCESSABLE_ENTITY
Apache::HTTP_UNSUPPORTED_MEDIA_TYPE
Apache::HTTP_UPGRADE_REQUIRED
Apache::HTTP_USE_PROXY
Apache::HTTP_VARIANT_ALSO_VARIES
:input_mode
use Apache::Const -compile => qw(:input_mode);
The :input_mode
group is used by get_brigade
.
Apache::MODE_EATCRLF
See Apache::Filter::get_brigade()
.
Apache::MODE_EXHAUSTIVE
See Apache::Filter::get_brigade()
.
Apache::MODE_GETLINE
See Apache::Filter::get_brigade()
.
Apache::MODE_INIT
See Apache::Filter::get_brigade()
.
Apache::MODE_READBYTES
See Apache::Filter::get_brigade()
.
Apache::MODE_SPECULATIVE
See Apache::Filter::get_brigade()
.
:log
use Apache::Const -compile => qw(:log);
The :log
group is for constants used by Apache::Log
.
Apache::LOG_ALERT
See Apache::Log
.
Apache::LOG_CRIT
See Apache::Log
.
Apache::LOG_DEBUG
See Apache::Log
.
Apache::LOG_EMERG
See Apache::Log
.
Apache::LOG_ERR
See Apache::Log
.
Apache::LOG_INFO
See Apache::Log
.
Apache::LOG_LEVELMASK
See Apache::Log
.
Apache::LOG_NOTICE
See Apache::Log
.
Apache::LOG_STARTUP
See Apache::Log
.
Apache::LOG_TOCLIENT
See Apache::Log
.
Apache::LOG_WARNING
See Apache::Log
.
:methods
use Apache::Const -compile => qw(:methods);
The :methods
constants group is used in conjunction with $r->method_number
.
Apache::METHODS
Apache::M_BASELINE_CONTROL
Apache::M_CHECKIN
Apache::M_CHECKOUT
Apache::M_CONNECT
Apache::M_COPY
Apache::M_DELETE
Apache::M_GET
corresponds to the HTTP GET
method
Apache::M_INVALID
Apache::M_LABEL
Apache::M_LOCK
Apache::M_MERGE
Apache::M_MKACTIVITY
Apache::M_MKCOL
Apache::M_MKWORKSPACE
Apache::M_MOVE
Apache::M_OPTIONS
Apache::M_PATCH
Apache::M_POST
corresponds to the HTTP POST
method
Apache::M_PROPFIND
Apache::M_PROPPATCH
Apache::M_PUT
corresponds to the HTTP PUT
method
Apache::M_REPORT
Apache::M_TRACE
Apache::M_UNCHECKOUT
Apache::M_UNLOCK
Apache::M_UPDATE
Apache::M_VERSION_CONTROL
:mpmq
use Apache::Const -compile => qw(:mpmq);
The :mpmq
group is for querying MPM properties.
Apache::MPMQ_NOT_SUPPORTED
Apache::MPMQ_STATIC
Apache::MPMQ_DYNAMIC
Apache::MPMQ_MAX_DAEMON_USED
Apache::MPMQ_IS_THREADED
Apache::MPMQ_IS_FORKED
Apache::MPMQ_HARD_LIMIT_DAEMONS
Apache::MPMQ_HARD_LIMIT_THREADS
Apache::MPMQ_MAX_THREADS
Apache::MPMQ_MIN_SPARE_DAEMONS
Apache::MPMQ_MIN_SPARE_THREADS
Apache::MPMQ_MAX_SPARE_DAEMONS
Apache::MPMQ_MAX_SPARE_THREADS
Apache::MPMQ_MAX_REQUESTS_DAEMON
Apache::MPMQ_MAX_DAEMONS
:options
use Apache::Const -compile => qw(:options);
The :options
group contains constants corresponding to the Options
configuration directive. For examples see: $r->allow_options
.
Apache::OPT_ALL
Apache::OPT_EXECCGI
Apache::OPT_INCLUDES
Apache::OPT_INCNOEXEC
Apache::OPT_INDEXES
Apache::OPT_MULTI
Apache::OPT_NONE
Apache::OPT_SYM_LINKS
Apache::OPT_SYM_OWNER
Apache::OPT_UNSET
:override
use Apache::Const -compile => qw(:override);
The :override
group contains constants corresponding to the AllowOverride
configuration directive. For examples see: $r->allow_options
.
Apache::ACCESS_CONF
*.conf inside <Directory>
or <Location>
Apache::OR_ALL
Apache::OR_LIMIT
| Apache::OR_OPTIONS
| Apache::OR_FILEINFO
| Apache::OR_AUTHCFG
| Apache::OR_INDEXES
Apache::OR_AUTHCFG
*.conf inside <Directory>
or <Location>
and .htaccess when AllowOverride AuthConfig
Apache::OR_FILEINFO
*.conf anywhere and .htaccess when AllowOverride FileInfo
Apache::OR_INDEXES
*.conf anywhere and .htaccess when AllowOverride Indexes
Apache::OR_LIMIT
*.conf inside <Directory>
or <Location>
and .htaccess when AllowOverride Limit
Apache::OR_NONE
*.conf is not available anywhere in this override
Apache::OR_OPTIONS
*.conf anywhere and .htaccess when AllowOverride Options
Apache::OR_UNSET
Unset a directive (in Allow
)
Apache::RSRC_CONF
*.conf outside <Directory>
or <Location>
:platform
use Apache::Const -compile => qw(:platform);
The :platform
group is for constants that may differ from OS to OS.
Apache::CRLF
Apache::CR
Apache::LF
:remotehost
use Apache::Const -compile => qw(:remotehost);
The :remotehost
constants group is is used by the $c->get_remote_host
method.
Apache::REMOTE_DOUBLE_REV
Apache::REMOTE_HOST
Apache::REMOTE_NAME
Apache::REMOTE_NOLOOKUP
:satisfy
use Apache::Const -compile => qw(:satisfy);
The :satisfy
constants group is used in conjunction with $r->satisfies
.
Apache::SATISFY_ALL
All of the requirements must be met.
Apache::SATISFY_ANY
any of the requirements must be met.
Apache::SATISFY_NOSPEC
There are no applicable satisfy lines
:types
use Apache::Const -compile => qw(:types);
The :types
group is for XXX constants.
Apache::DIR_MAGIC_TYPE
See Also
Copyright
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.