Apache2::Const - Perl Interface for Apache Constants
# make the constants available but don't import them
use Apache2::Const -compile => qw(constant names ...);
# w/o the => syntax sugar
use Apache2::Const ("-compile", qw(constant names ...));
# compile and import the constants
use Apache2::Const qw(constant names ...);
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 Apache2::Const -compile => qw(FORBIDDEN OK);
makes the constants Apache2::Const::FORBIDDEN and Apache2::Const::OK available to your code, but they aren't imported. In which case you need to use a fully qualified constants, as in:
return Apache2::Const::OK;
If you drop the argument -compile and write:
use Apache2::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.
Finally, 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 Apache2::Const -compile => qw(FORBIDDEN OK);
you could write:
use Apache2::Const "-compile", qw(FORBIDDEN OK);
and for parentheses-lovers:
use Apache2::Const ("-compile", qw(FORBIDDEN OK));
:cmd_howuse Apache2::Const -compile => qw(:cmd_how);
The :cmd_how constants group is used in Apache2::Module::add() and $cmds->args_how.
Apache2::Const::FLAGOne of On or Off (full description).
Apache2::Const::ITERATEOne argument, occurring multiple times (full description).
Apache2::Const::ITERATE2Two arguments, the second occurs multiple times (full description).
Apache2::Const::NO_ARGSNo arguments at all (full description).
Apache2::Const::RAW_ARGSThe command will parse the command line itself (full description).
Apache2::Const::TAKE1One argument only (full description).
Apache2::Const::TAKE12One or two arguments (full description).
Apache2::Const::TAKE123One, two or three arguments (full description).
Apache2::Const::TAKE13One or three arguments (full description).
Apache2::Const::TAKE2Two arguments (full description).
Apache2::Const::TAKE23Two or three arguments (full description).
Apache2::Const::TAKE3Three arguments (full description).
:commonuse Apache2::Const -compile => qw(:common);
The :common group is for XXX constants.
Apache2::Const::AUTH_REQUIREDApache2::Const::DECLINEDApache2::Const::DONEApache2::Const::FORBIDDENApache2::Const::NOT_FOUNDApache2::Const::OKApache2::Const::REDIRECTApache2::Const::SERVER_ERROR:configuse Apache2::Const -compile => qw(:config);
The :config group is for XXX constants.
Apache2::Const::DECLINE_CMD:conn_keepaliveuse Apache2::Const -compile => qw(:conn_keepalive);
The :conn_keepalive constants group is used by the ($c->keepalive) method.
Apache2::Const::CONN_CLOSEThe connection will be closed at the end of the current HTTP request.
Apache2::Const::CONN_KEEPALIVEThe connection will be kept alive at the end of the current HTTP request.
Apache2::Const::CONN_UNKNOWNThe connection is at an unknown state, e.g., initialized but not open yet.
:contextuse Apache2::Const -compile => qw(:context);
The :context group is used by the $parms->check_cmd_context method.
Apache2::Const::NOT_IN_VIRTUALHOSTThe command is not in a <VirtualHost> block.
Apache2::Const::NOT_IN_LIMITThe command is not in a <Limit> block.
Apache2::Const::NOT_IN_DIRECTORYThe command is not in a <Directory> block.
Apache2::Const::NOT_IN_LOCATIONThe command is not in a <Location>/<LocationMatch> block.
Apache2::Const::NOT_IN_FILESThe command is not in a <Files>/<FilesMatch> block.
Apache2::Const::NOT_IN_DIR_LOC_FILEThe command is not in a <Files>/<FilesMatch>, <Location>/<LocationMatch> or <Directory> block.
Apache2::Const::GLOBAL_ONLYThe directive appears outside of any container directives.
:filter_typeuse Apache2::Const -compile => qw(:filter_type);
The :filter_type group is for XXX constants.
Apache2::Const::FTYPE_CONNECTIONApache2::Const::FTYPE_CONTENT_SETApache2::Const::FTYPE_NETWORKApache2::Const::FTYPE_PROTOCOLApache2::Const::FTYPE_RESOURCEApache2::Const::FTYPE_TRANSCODE:httpuse Apache2::Const -compile => qw(:http);
The :http group is for XXX constants.
Apache2::Const::HTTP_ACCEPTEDApache2::Const::HTTP_BAD_GATEWAYApache2::Const::HTTP_BAD_REQUESTApache2::Const::HTTP_CONFLICTApache2::Const::HTTP_CONTINUEApache2::Const::HTTP_CREATEDApache2::Const::HTTP_EXPECTATION_FAILEDApache2::Const::HTTP_FAILED_DEPENDENCYApache2::Const::HTTP_FORBIDDENApache2::Const::HTTP_GATEWAY_TIME_OUTApache2::Const::HTTP_GONEApache2::Const::HTTP_INSUFFICIENT_STORAGEApache2::Const::HTTP_INTERNAL_SERVER_ERRORApache2::Const::HTTP_LENGTH_REQUIREDApache2::Const::HTTP_LOCKEDApache2::Const::HTTP_METHOD_NOT_ALLOWEDApache2::Const::HTTP_MOVED_PERMANENTLYApache2::Const::HTTP_MOVED_TEMPORARILYApache2::Const::HTTP_MULTIPLE_CHOICESApache2::Const::HTTP_MULTI_STATUSApache2::Const::HTTP_NON_AUTHORITATIVEApache2::Const::HTTP_NOT_ACCEPTABLEApache2::Const::HTTP_NOT_EXTENDEDApache2::Const::HTTP_NOT_FOUNDApache2::Const::HTTP_NOT_IMPLEMENTEDApache2::Const::HTTP_NOT_MODIFIEDApache2::Const::HTTP_NO_CONTENTApache2::Const::HTTP_OKApache2::Const::HTTP_PARTIAL_CONTENTApache2::Const::HTTP_PAYMENT_REQUIREDApache2::Const::HTTP_PRECONDITION_FAILEDApache2::Const::HTTP_PROCESSINGApache2::Const::HTTP_PROXY_AUTHENTICATION_REQUIREDApache2::Const::HTTP_RANGE_NOT_SATISFIABLEApache2::Const::HTTP_REQUEST_ENTITY_TOO_LARGEApache2::Const::HTTP_REQUEST_TIME_OUTApache2::Const::HTTP_REQUEST_URI_TOO_LARGEApache2::Const::HTTP_RESET_CONTENTApache2::Const::HTTP_SEE_OTHERApache2::Const::HTTP_SERVICE_UNAVAILABLEApache2::Const::HTTP_SWITCHING_PROTOCOLSApache2::Const::HTTP_TEMPORARY_REDIRECTApache2::Const::HTTP_UNAUTHORIZEDApache2::Const::HTTP_UNPROCESSABLE_ENTITYApache2::Const::HTTP_UNSUPPORTED_MEDIA_TYPEApache2::Const::HTTP_UPGRADE_REQUIREDApache2::Const::HTTP_USE_PROXYApache2::Const::HTTP_VARIANT_ALSO_VARIES:input_modeuse Apache2::Const -compile => qw(:input_mode);
The :input_mode group is used by get_brigade.
Apache2::Const::MODE_EATCRLFSee Apache2::Filter::get_brigade().
Apache2::Const::MODE_EXHAUSTIVESee Apache2::Filter::get_brigade().
Apache2::Const::MODE_GETLINESee Apache2::Filter::get_brigade().
Apache2::Const::MODE_INITSee Apache2::Filter::get_brigade().
Apache2::Const::MODE_READBYTESSee Apache2::Filter::get_brigade().
Apache2::Const::MODE_SPECULATIVESee Apache2::Filter::get_brigade().
:loguse Apache2::Const -compile => qw(:log);
The :log group is for constants used by Apache2::Log.
Apache2::Const::LOG_ALERTSee Apache2::Log.
Apache2::Const::LOG_CRITSee Apache2::Log.
Apache2::Const::LOG_DEBUGSee Apache2::Log.
Apache2::Const::LOG_EMERGSee Apache2::Log.
Apache2::Const::LOG_ERRSee Apache2::Log.
Apache2::Const::LOG_INFOSee Apache2::Log.
Apache2::Const::LOG_LEVELMASKSee Apache2::Log.
Apache2::Const::LOG_NOTICESee Apache2::Log.
Apache2::Const::LOG_STARTUPSee Apache2::Log.
Apache2::Const::LOG_TOCLIENTSee Apache2::Log.
Apache2::Const::LOG_WARNINGSee Apache2::Log.
:methodsuse Apache2::Const -compile => qw(:methods);
The :methods constants group is used in conjunction with $r->method_number.
Apache2::Const::METHODSApache2::Const::M_BASELINE_CONTROLApache2::Const::M_CHECKINApache2::Const::M_CHECKOUTApache2::Const::M_CONNECTApache2::Const::M_COPYApache2::Const::M_DELETEApache2::Const::M_GETcorresponds to the HTTP GET method
Apache2::Const::M_INVALIDApache2::Const::M_LABELApache2::Const::M_LOCKApache2::Const::M_MERGEApache2::Const::M_MKACTIVITYApache2::Const::M_MKCOLApache2::Const::M_MKWORKSPACEApache2::Const::M_MOVEApache2::Const::M_OPTIONSApache2::Const::M_PATCHApache2::Const::M_POSTcorresponds to the HTTP POST method
Apache2::Const::M_PROPFINDApache2::Const::M_PROPPATCHApache2::Const::M_PUTcorresponds to the HTTP PUT method
Apache2::Const::M_REPORTApache2::Const::M_TRACEApache2::Const::M_UNCHECKOUTApache2::Const::M_UNLOCKApache2::Const::M_UPDATEApache2::Const::M_VERSION_CONTROL:mpmquse Apache2::Const -compile => qw(:mpmq);
The :mpmq group is for querying MPM properties.
Apache2::Const::MPMQ_NOT_SUPPORTEDApache2::Const::MPMQ_STATICApache2::Const::MPMQ_DYNAMICApache2::Const::MPMQ_MAX_DAEMON_USEDApache2::Const::MPMQ_IS_THREADEDApache2::Const::MPMQ_IS_FORKEDApache2::Const::MPMQ_HARD_LIMIT_DAEMONSApache2::Const::MPMQ_HARD_LIMIT_THREADSApache2::Const::MPMQ_MAX_THREADSApache2::Const::MPMQ_MIN_SPARE_DAEMONSApache2::Const::MPMQ_MIN_SPARE_THREADSApache2::Const::MPMQ_MAX_SPARE_DAEMONSApache2::Const::MPMQ_MAX_SPARE_THREADSApache2::Const::MPMQ_MAX_REQUESTS_DAEMONApache2::Const::MPMQ_MAX_DAEMONS:optionsuse Apache2::Const -compile => qw(:options);
The :options group contains constants corresponding to the Options configuration directive. For examples see: $r->allow_options.
Apache2::Const::OPT_ALLApache2::Const::OPT_EXECCGIApache2::Const::OPT_INCLUDESApache2::Const::OPT_INCNOEXECApache2::Const::OPT_INDEXESApache2::Const::OPT_MULTIApache2::Const::OPT_NONEApache2::Const::OPT_SYM_LINKSApache2::Const::OPT_SYM_OWNERApache2::Const::OPT_UNSET:overrideuse Apache2::Const -compile => qw(:override);
The :override group contains constants corresponding to the AllowOverride configuration directive. For examples see: $r->allow_options.
Apache2::Const::ACCESS_CONF*.conf inside <Directory> or <Location>
Apache2::Const::EXEC_ON_READForce directive to execute a command which would modify the configuration (like including another file, or IFModule)
Apache2::Const::OR_ALLApache2::Const::OR_LIMIT | Apache2::Const::OR_OPTIONS | Apache2::Const::OR_FILEINFO | Apache2::Const::OR_AUTHCFG | Apache2::Const::OR_INDEXES
Apache2::Const::OR_AUTHCFG*.conf inside <Directory> or <Location> and .htaccess when AllowOverride AuthConfig
Apache2::Const::OR_FILEINFO*.conf anywhere and .htaccess when AllowOverride FileInfo
Apache2::Const::OR_INDEXES*.conf anywhere and .htaccess when AllowOverride Indexes
Apache2::Const::OR_LIMIT*.conf inside <Directory> or <Location> and .htaccess when AllowOverride Limit
Apache2::Const::OR_NONE*.conf is not available anywhere in this override
Apache2::Const::OR_OPTIONS*.conf anywhere and .htaccess when AllowOverride Options
Apache2::Const::OR_UNSETUnset a directive (in Allow)
Apache2::Const::RSRC_CONF*.conf outside <Directory> or <Location>
:platformuse Apache2::Const -compile => qw(:platform);
The :platform group is for constants that may differ from OS to OS.
Apache2::Const::CRLFApache2::Const::CRApache2::Const::LF:remotehostuse Apache2::Const -compile => qw(:remotehost);
The :remotehost constants group is is used by the $c->get_remote_host method.
Apache2::Const::REMOTE_DOUBLE_REVApache2::Const::REMOTE_HOSTApache2::Const::REMOTE_NAMEApache2::Const::REMOTE_NOLOOKUP:satisfyuse Apache2::Const -compile => qw(:satisfy);
The :satisfy constants group is used in conjunction with $r->satisfies.
Apache2::Const::SATISFY_ALLAll of the requirements must be met.
Apache2::Const::SATISFY_ANYany of the requirements must be met.
Apache2::Const::SATISFY_NOSPECThere are no applicable satisfy lines
:typesuse Apache2::Const -compile => qw(:types);
The :types group is for XXX constants.
Apache2::Const::DIR_MAGIC_TYPE:proxyuse Apache2::Const -compile => qw(:proxy);
The :proxy constants group is used in conjunction with $r->proxyreq.
Apache2::Const::PROXYREQ_NONEApache2::Const::PROXYREQ_PROXYApache2::Const::PROXYREQ_REVERSEApache2::Const::PROXYREQ_RESPONSEmod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.