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).

since: 1.99_12

Apache::ITERATE

One argument, occuring multiple times (full description).

since: 1.99_12

Apache::ITERATE2

Two arguments, the second occurs multiple times (full description).

since: 1.99_12

Apache::NO_ARGS

No arguments at all (full description).

since: 1.99_12

Apache::RAW_ARGS

The command will parse the command line itself (full description).

since: 1.99_12

Apache::TAKE1

One argument only (full description).

since: 1.99_12

Apache::TAKE12

One or two arguments (full description).

since: 1.99_12

Apache::TAKE123

One, two or three arguments (full description).

since: 1.99_12

Apache::TAKE13

One or three arguments (full description).

since: 1.99_12

Apache::TAKE2

Two arguments (full description).

since: 1.99_12

Apache::TAKE23

Two or three arguments (full description).

since: 1.99_12

Apache::TAKE3

Three arguments (full description).

since: 1.99_12

:common

use Apache::Const -compile => qw(:common);

The :common group is for XXX constants.

Apache::AUTH_REQUIRED

since: 1.99_12

Apache::DECLINED

since: 1.99_12

Apache::DONE

since: 1.99_12

Apache::FORBIDDEN

since: 1.99_12

Apache::NOT_FOUND

since: 1.99_12

Apache::OK

since: 1.99_12

Apache::REDIRECT

since: 1.99_12

Apache::SERVER_ERROR

since: 1.99_12

:config

use Apache::Const -compile => qw(:config);

The :config group is for XXX constants.

Apache::DECLINE_CMD

since: 1.99_12

: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.

since: 1.99_13

Apache::CONN_KEEPALIVE

The connection will be kept alive at the end of the current HTTP request.

since: 1.99_13

Apache::CONN_UNKNOWN

The connection is at an unknown state, e.g., initialized but not open yet.

since: 1.99_13

: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.

since: 1.99_15

Apache::NOT_IN_LIMIT

The command is not in a <Limit> block.

since: 1.99_15

Apache::NOT_IN_DIRECTORY

The command is not in a <Directory> block.

since: 1.99_15

Apache::NOT_IN_LOCATION

The command is not in a <Location>/<LocationMatch> block.

since: 1.99_15

Apache::NOT_IN_FILES

The command is not in a <Files>/<FilesMatch> block.

since: 1.99_15

Apache::NOT_IN_DIR_LOC_FILE

The command is not in a <Files>/<FilesMatch>, <Location>/<LocationMatch> or <Directory> block.

since: 1.99_15

Apache::GLOBAL_ONLY

The directive appears outside of any container directives.

since: 1.99_15

:filter_type

use Apache::Const -compile => qw(:filter_type);

The :filter_type group is for XXX constants.

Apache::FTYPE_CONNECTION

since: 1.99_12

Apache::FTYPE_CONTENT_SET

since: 1.99_12

Apache::FTYPE_NETWORK

since: 1.99_12

Apache::FTYPE_PROTOCOL

since: 1.99_12

Apache::FTYPE_RESOURCE

since: 1.99_12

Apache::FTYPE_TRANSCODE

since: 1.99_12

:http

use Apache::Const -compile => qw(:http);

The :http group is for XXX constants.

Apache::HTTP_ACCEPTED

since: 1.99_12

Apache::HTTP_BAD_GATEWAY

since: 1.99_12

Apache::HTTP_BAD_REQUEST

since: 1.99_12

Apache::HTTP_CONFLICT

since: 1.99_12

Apache::HTTP_CONTINUE

since: 1.99_12

Apache::HTTP_CREATED

since: 1.99_12

Apache::HTTP_EXPECTATION_FAILED

since: 1.99_12

Apache::HTTP_FAILED_DEPENDENCY

since: 1.99_12

Apache::HTTP_FORBIDDEN

since: 1.99_12

Apache::HTTP_GATEWAY_TIME_OUT

since: 1.99_12

Apache::HTTP_GONE

since: 1.99_12

Apache::HTTP_INSUFFICIENT_STORAGE

since: 1.99_12

Apache::HTTP_INTERNAL_SERVER_ERROR

since: 1.99_12

Apache::HTTP_LENGTH_REQUIRED

since: 1.99_12

Apache::HTTP_LOCKED

since: 1.99_12

Apache::HTTP_METHOD_NOT_ALLOWED

since: 1.99_12

Apache::HTTP_MOVED_PERMANENTLY

since: 1.99_12

Apache::HTTP_MOVED_TEMPORARILY

since: 1.99_12

Apache::HTTP_MULTIPLE_CHOICES

since: 1.99_12

Apache::HTTP_MULTI_STATUS

since: 1.99_12

Apache::HTTP_NON_AUTHORITATIVE

since: 1.99_12

Apache::HTTP_NOT_ACCEPTABLE

since: 1.99_12

Apache::HTTP_NOT_EXTENDED

since: 1.99_12

Apache::HTTP_NOT_FOUND

since: 1.99_12

Apache::HTTP_NOT_IMPLEMENTED

since: 1.99_12

Apache::HTTP_NOT_MODIFIED

since: 1.99_12

Apache::HTTP_NO_CONTENT

since: 1.99_12

Apache::HTTP_OK

since: 1.99_12

Apache::HTTP_PARTIAL_CONTENT

since: 1.99_12

Apache::HTTP_PAYMENT_REQUIRED

since: 1.99_12

Apache::HTTP_PRECONDITION_FAILED

since: 1.99_12

Apache::HTTP_PROCESSING

since: 1.99_12

Apache::HTTP_PROXY_AUTHENTICATION_REQUIRED

since: 1.99_12

Apache::HTTP_RANGE_NOT_SATISFIABLE

since: 1.99_12

Apache::HTTP_REQUEST_ENTITY_TOO_LARGE

since: 1.99_12

Apache::HTTP_REQUEST_TIME_OUT

since: 1.99_12

Apache::HTTP_REQUEST_URI_TOO_LARGE

since: 1.99_12

Apache::HTTP_RESET_CONTENT

since: 1.99_12

Apache::HTTP_SEE_OTHER

since: 1.99_12

Apache::HTTP_SERVICE_UNAVAILABLE

since: 1.99_12

Apache::HTTP_SWITCHING_PROTOCOLS

since: 1.99_12

Apache::HTTP_TEMPORARY_REDIRECT

since: 1.99_12

Apache::HTTP_UNAUTHORIZED

since: 1.99_12

Apache::HTTP_UNPROCESSABLE_ENTITY

since: 1.99_12

Apache::HTTP_UNSUPPORTED_MEDIA_TYPE

since: 1.99_12

Apache::HTTP_UPGRADE_REQUIRED

since: 1.99_12

Apache::HTTP_USE_PROXY

since: 1.99_12

Apache::HTTP_VARIANT_ALSO_VARIES

since: 1.99_12

:input_mode

use Apache::Const -compile => qw(:input_mode);

The :input_mode group is used by get_brigade.

Apache::MODE_EATCRLF

since: 1.99_12

See Apache::Filter::get_brigade().

Apache::MODE_EXHAUSTIVE

since: 1.99_12

See Apache::Filter::get_brigade().

Apache::MODE_GETLINE

since: 1.99_12

See Apache::Filter::get_brigade().

Apache::MODE_INIT

since: 1.99_12

See Apache::Filter::get_brigade().

Apache::MODE_READBYTES

since: 1.99_12

See Apache::Filter::get_brigade().

Apache::MODE_SPECULATIVE

since: 1.99_12

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

since: 1.99_12

See Apache::Log.

Apache::LOG_CRIT

since: 1.99_12

See Apache::Log.

Apache::LOG_DEBUG

since: 1.99_12

See Apache::Log.

Apache::LOG_EMERG

since: 1.99_12

See Apache::Log.

Apache::LOG_ERR

since: 1.99_12

See Apache::Log.

Apache::LOG_INFO

since: 1.99_12

See Apache::Log.

Apache::LOG_LEVELMASK

since: 1.99_12

See Apache::Log.

Apache::LOG_NOTICE

since: 1.99_12

See Apache::Log.

Apache::LOG_STARTUP

since: 1.99_12

See Apache::Log.

Apache::LOG_TOCLIENT

since: 1.99_12

See Apache::Log.

Apache::LOG_WARNING

since: 1.99_12

See Apache::Log.

:methods

use Apache::Const -compile => qw(:methods);

The :methods constants group is used in conjunction with $r->method_number.

Apache::METHODS

since: 1.99_12

Apache::M_BASELINE_CONTROL

since: 1.99_12

Apache::M_CHECKIN

since: 1.99_12

Apache::M_CHECKOUT

since: 1.99_12

Apache::M_CONNECT

since: 1.99_12

Apache::M_COPY

since: 1.99_12

Apache::M_DELETE

since: 1.99_12

Apache::M_GET

since: 1.99_12

corresponds to the HTTP GET method

Apache::M_INVALID

since: 1.99_12

Apache::M_LABEL

since: 1.99_12

Apache::M_LOCK

since: 1.99_12

Apache::M_MERGE

since: 1.99_12

Apache::M_MKACTIVITY

since: 1.99_12

Apache::M_MKCOL

since: 1.99_12

Apache::M_MKWORKSPACE

since: 1.99_12

Apache::M_MOVE

since: 1.99_12

Apache::M_OPTIONS

since: 1.99_12

Apache::M_PATCH

since: 1.99_12

Apache::M_POST

since: 1.99_12

corresponds to the HTTP POST method

Apache::M_PROPFIND

since: 1.99_12

Apache::M_PROPPATCH

since: 1.99_12

Apache::M_PUT

since: 1.99_12

corresponds to the HTTP PUT method

Apache::M_REPORT

since: 1.99_12

Apache::M_TRACE

since: 1.99_12

Apache::M_UNCHECKOUT

since: 1.99_12

Apache::M_UNLOCK

since: 1.99_12

Apache::M_UPDATE

since: 1.99_12

Apache::M_VERSION_CONTROL

since: 1.99_12

:mpmq

use Apache::Const -compile => qw(:mpmq);

The :mpmq group is for querying MPM properties.

Apache::MPMQ_NOT_SUPPORTED

since: 1.99_12

Apache::MPMQ_STATIC

since: 1.99_12

Apache::MPMQ_DYNAMIC

since: 1.99_12

Apache::MPMQ_MAX_DAEMON_USED

since: 1.99_12

Apache::MPMQ_IS_THREADED

since: 1.99_12

Apache::MPMQ_IS_FORKED

since: 1.99_12

Apache::MPMQ_HARD_LIMIT_DAEMONS

since: 1.99_12

Apache::MPMQ_HARD_LIMIT_THREADS

since: 1.99_12

Apache::MPMQ_MAX_THREADS

since: 1.99_12

Apache::MPMQ_MIN_SPARE_DAEMONS

since: 1.99_12

Apache::MPMQ_MIN_SPARE_THREADS

since: 1.99_12

Apache::MPMQ_MAX_SPARE_DAEMONS

since: 1.99_12

Apache::MPMQ_MAX_SPARE_THREADS

since: 1.99_12

Apache::MPMQ_MAX_REQUESTS_DAEMON

since: 1.99_12

Apache::MPMQ_MAX_DAEMONS

since: 1.99_12

: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

since: 1.99_12

Apache::OPT_EXECCGI

since: 1.99_12

Apache::OPT_INCLUDES

since: 1.99_12

Apache::OPT_INCNOEXEC

since: 1.99_12

Apache::OPT_INDEXES

since: 1.99_12

Apache::OPT_MULTI

since: 1.99_12

Apache::OPT_NONE

since: 1.99_12
since: 1.99_12

Apache::OPT_SYM_OWNER

since: 1.99_12

Apache::OPT_UNSET

since: 1.99_12

: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>

since: 1.99_12

Apache::OR_ALL

Apache::OR_LIMIT | Apache::OR_OPTIONS | Apache::OR_FILEINFO | Apache::OR_AUTHCFG | Apache::OR_INDEXES

since: 1.99_12

Apache::OR_AUTHCFG

*.conf inside <Directory> or <Location> and .htaccess when AllowOverride AuthConfig

since: 1.99_12

Apache::OR_FILEINFO

*.conf anywhere and .htaccess when AllowOverride FileInfo

since: 1.99_12

Apache::OR_INDEXES

*.conf anywhere and .htaccess when AllowOverride Indexes

since: 1.99_12

Apache::OR_LIMIT

*.conf inside <Directory> or <Location> and .htaccess when AllowOverride Limit

since: 1.99_12

Apache::OR_NONE

*.conf is not available anywhere in this override

since: 1.99_12

Apache::OR_OPTIONS

*.conf anywhere and .htaccess when AllowOverride Options

since: 1.99_12

Apache::OR_UNSET

Unset a directive (in Allow)

since: 1.99_12

Apache::RSRC_CONF

*.conf outside <Directory> or <Location>

since: 1.99_12

:platform

use Apache::Const -compile => qw(:platform);

The :platform group is for constants that may differ from OS to OS.

Apache::CRLF

since: 1.99_12

Apache::CR

since: 1.99_12

Apache::LF

since: 1.99_12

: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

since: 1.99_12

Apache::REMOTE_HOST

since: 1.99_12

Apache::REMOTE_NAME

since: 1.99_12

Apache::REMOTE_NOLOOKUP

since: 1.99_12

:satisfy

use Apache::Const -compile => qw(:satisfy);

The :satisfy constants group is used in conjunction with $r->satisfies.

Apache::SATISFY_ALL

since: 1.99_12

All of the requirements must be met.

Apache::SATISFY_ANY

since: 1.99_12

any of the requirements must be met.

Apache::SATISFY_NOSPEC

since: 1.99_12

There are no applicable satisfy lines

:types

use Apache::Const -compile => qw(:types);

The :types group is for XXX constants.

Apache::DIR_MAGIC_TYPE

since: 1.99_12

See Also

mod_perl 2.0 documentation.

Copyright

mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.

Authors

The mod_perl development team and numerous contributors.