docs::a...2::Const(3)
π NAME π
okay bestie, this is Apache2::Const β literally the Perl interface for Apache constants, from the docs::a...2::Const(3) manual page. It's the constants closet for mod_perl 2.0 Apache features. π
β¨ Synopsis β¨
Three ways to summon the constants, queen:
# 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 ...);
πΈ Description πΈ
This package is where constants specific to Apache features live. π
mod_perl 2.0 comes with several hundreds of constants, and you do not want to make all of them available to your Perl code by default β the CPU and memory overhead would be giving unnecessary main-character chaos. So when you want a certain constant, you need to explicitly ask to make it available. β¨
For example, this 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 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 β because of the extra memory requirement when importing symbols, and because 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 it also 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));
π¦ Constants π¦
π :cmd_how π
use Apache2::Const -compile => qw(:cmd_how);
The :cmd_how constants group is used in Apache2::Module::add() and $cmds->args_how. π₯
Apache2::Const::FLAGβ One of On or Off (full description). β¨since: 2.0.00Apache2::Const::ITERATEβ One argument, occurring multiple times (full description). β¨since: 2.0.00Apache2::Const::ITERATE2β Two arguments, the second occurs multiple times (full description). β¨since: 2.0.00Apache2::Const::NO_ARGSβ No arguments at all (full description). β¨since: 2.0.00Apache2::Const::RAW_ARGSβ The command will parse the command line itself (full description). β¨since: 2.0.00Apache2::Const::TAKE1β One argument only (full description). β¨since: 2.0.00Apache2::Const::TAKE12β One or two arguments (full description). β¨since: 2.0.00Apache2::Const::TAKE123β One, two or three arguments (full description). β¨since: 2.0.00Apache2::Const::TAKE13β One or three arguments (full description). β¨since: 2.0.00Apache2::Const::TAKE2β Two arguments (full description). β¨since: 2.0.00Apache2::Const::TAKE23β Two or three arguments (full description). β¨since: 2.0.00Apache2::Const::TAKE3β Three arguments (full description). β¨since: 2.0.00
π :common π
use Apache2::Const -compile => qw(:common);
The :common group is for XXX constants. (Yes, the docs literally say XXX, and we respect the icon.) π
Apache2::Const::AUTH_REQUIREDβsince: 2.0.00β¨Apache2::Const::DECLINEDβsince: 2.0.00β¨Apache2::Const::DONEβsince: 2.0.00β¨Apache2::Const::FORBIDDENβsince: 2.0.00β¨Apache2::Const::NOT_FOUNDβsince: 2.0.00β¨Apache2::Const::OKβsince: 2.0.00β¨Apache2::Const::REDIRECTβsince: 2.0.00β¨Apache2::Const::SERVER_ERRORβsince: 2.0.00β¨
π§ :config π§
use Apache2::Const -compile => qw(:config);
The :config group is for XXX constants. π
Apache2::Const::DECLINE_CMDβsince: 2.0.00β¨
π¦ :conn_keepalive π¦
use Apache2::Const -compile => qw(:conn_keepalive);
The :conn_keepalive constants group is used by the $c->keepalive method. π«Ά
Apache2::Const::CONN_CLOSEβ The connection will be closed at the end of the current HTTP request. β¨since: 2.0.00Apache2::Const::CONN_KEEPALIVEβ The connection will be kept alive at the end of the current HTTP request. β¨since: 2.0.00Apache2::Const::CONN_UNKNOWNβ The connection is at an unknown state, e.g., initialized but not open yet. β¨since: 2.0.00
π :context π
use Apache2::Const -compile => qw(:context);
The :context group is used by the $parms->check_cmd_context method. π
Apache2::Const::NOT_IN_VIRTUALHOSTβ The command is not in a<VirtualHost>block. β¨since: 2.0.00Apache2::Const::NOT_IN_LIMITβ The command is not in a<Limit>block. β¨since: 2.0.00Apache2::Const::NOT_IN_DIRECTORYβ The command is not in a<Directory>block. β¨since: 2.0.00Apache2::Const::NOT_IN_LOCATIONβ The command is not in a<Location>/<LocationMatch>block. β¨since: 2.0.00Apache2::Const::NOT_IN_FILESβ The command is not in a<Files>/<FilesMatch>block. β¨since: 2.0.00Apache2::Const::NOT_IN_DIR_LOC_FILEβ The command is not in a<Files>/<FilesMatch>,<Location>/<LocationMatch>or<Directory>block. β¨since: 2.0.00Apache2::Const::GLOBAL_ONLYβ The directive appears outside of any container directives. β¨since: 2.0.00
π :filter_type π
use Apache2::Const -compile => qw(:filter_type);
The :filter_type group is for XXX constants. π
Apache2::Const::FTYPE_CONNECTIONβsince: 2.0.00β¨Apache2::Const::FTYPE_CONTENT_SETβsince: 2.0.00β¨Apache2::Const::FTYPE_NETWORKβsince: 2.0.00β¨Apache2::Const::FTYPE_PROTOCOLβsince: 2.0.00β¨Apache2::Const::FTYPE_RESOURCEβsince: 2.0.00β¨Apache2::Const::FTYPE_TRANSCODEβsince: 2.0.00β¨
π :http π
use Apache2::Const -compile => qw(:http);
The :http group is for XXX constants. π
Apache2::Const::HTTP_ACCEPTEDβsince: 2.0.00β¨Apache2::Const::HTTP_BAD_GATEWAYβsince: 2.0.00β¨Apache2::Const::HTTP_BAD_REQUESTβsince: 2.0.00β¨Apache2::Const::HTTP_CONFLICTβsince: 2.0.00β¨Apache2::Const::HTTP_CONTINUEβsince: 2.0.00β¨Apache2::Const::HTTP_CREATEDβsince: 2.0.00β¨Apache2::Const::HTTP_EXPECTATION_FAILEDβsince: 2.0.00β¨Apache2::Const::HTTP_FAILED_DEPENDENCYβsince: 2.0.00β¨Apache2::Const::HTTP_FORBIDDENβsince: 2.0.00β¨Apache2::Const::HTTP_GATEWAY_TIME_OUTβsince: 2.0.00β¨Apache2::Const::HTTP_GONEβsince: 2.0.00β¨Apache2::Const::HTTP_INSUFFICIENT_STORAGEβsince: 2.0.00β¨Apache2::Const::HTTP_INTERNAL_SERVER_ERRORβsince: 2.0.00β¨Apache2::Const::HTTP_LENGTH_REQUIREDβsince: 2.0.00β¨Apache2::Const::HTTP_LOCKEDβsince: 2.0.00β¨Apache2::Const::HTTP_METHOD_NOT_ALLOWEDβsince: 2.0.00β¨Apache2::Const::HTTP_MOVED_PERMANENTLYβsince: 2.0.00β¨Apache2::Const::HTTP_MOVED_TEMPORARILYβsince: 2.0.00β¨Apache2::Const::HTTP_MULTIPLE_CHOICESβsince: 2.0.00β¨Apache2::Const::HTTP_MULTI_STATUSβsince: 2.0.00β¨Apache2::Const::HTTP_NON_AUTHORITATIVEβsince: 2.0.00β¨Apache2::Const::HTTP_NOT_ACCEPTABLEβsince: 2.0.00β¨Apache2::Const::HTTP_NOT_EXTENDEDβsince: 2.0.00β¨Apache2::Const::HTTP_NOT_FOUNDβsince: 2.0.00β¨Apache2::Const::HTTP_NOT_IMPLEMENTEDβsince: 2.0.00β¨Apache2::Const::HTTP_NOT_MODIFIEDβsince: 2.0.00β¨Apache2::Const::HTTP_NO_CONTENTβsince: 2.0.00β¨Apache2::Const::HTTP_OKβsince: 2.0.00β¨Apache2::Const::HTTP_PARTIAL_CONTENTβsince: 2.0.00β¨Apache2::Const::HTTP_PAYMENT_REQUIREDβsince: 2.0.00β¨Apache2::Const::HTTP_PRECONDITION_FAILEDβsince: 2.0.00β¨Apache2::Const::HTTP_PROCESSINGβsince: 2.0.00β¨Apache2::Const::HTTP_PROXY_AUTHENTICATION_REQUIREDβsince: 2.0.00β¨Apache2::Const::HTTP_RANGE_NOT_SATISFIABLEβsince: 2.0.00β¨Apache2::Const::HTTP_REQUEST_ENTITY_TOO_LARGEβsince: 2.0.00β¨Apache2::Const::HTTP_REQUEST_TIME_OUTβsince: 2.0.00β¨Apache2::Const::HTTP_REQUEST_URI_TOO_LARGEβsince: 2.0.00β¨Apache2::Const::HTTP_RESET_CONTENTβsince: 2.0.00β¨Apache2::Const::HTTP_SEE_OTHERβsince: 2.0.00β¨Apache2::Const::HTTP_SERVICE_UNAVAILABLEβsince: 2.0.00β¨Apache2::Const::HTTP_SWITCHING_PROTOCOLSβsince: 2.0.00β¨Apache2::Const::HTTP_TEMPORARY_REDIRECTβsince: 2.0.00β¨Apache2::Const::HTTP_UNAUTHORIZEDβsince: 2.0.00β¨Apache2::Const::HTTP_UNPROCESSABLE_ENTITYβsince: 2.0.00β¨Apache2::Const::HTTP_UNSUPPORTED_MEDIA_TYPEβsince: 2.0.00β¨Apache2::Const::HTTP_UPGRADE_REQUIREDβsince: 2.0.00β¨Apache2::Const::HTTP_USE_PROXYβsince: 2.0.00β¨Apache2::Const::HTTP_VARIANT_ALSO_VARIESβsince: 2.0.00β¨
π§Έ :input_mode π§Έ
use Apache2::Const -compile => qw(:input_mode);
The :input_mode group is used by get_brigade. π
Apache2::Const::MODE_EATCRLFβsince: 2.0.00β¨ SeeApache2::Filter::get_brigade().Apache2::Const::MODE_EXHAUSTIVEβsince: 2.0.00β¨ SeeApache2::Filter::get_brigade().Apache2::Const::MODE_GETLINEβsince: 2.0.00β¨ SeeApache2::Filter::get_brigade().Apache2::Const::MODE_INITβsince: 2.0.00β¨ SeeApache2::Filter::get_brigade().Apache2::Const::MODE_READBYTESβsince: 2.0.00β¨ SeeApache2::Filter::get_brigade().Apache2::Const::MODE_SPECULATIVEβsince: 2.0.00β¨ SeeApache2::Filter::get_brigade().
π :log π
use Apache2::Const -compile => qw(:log);
The :log group is for constants used by Apache2::Log. π₯
Apache2::Const::LOG_ALERTβsince: 2.0.00β¨ SeeApache2::Log.Apache2::Const::LOG_CRITβsince: 2.0.00β¨ SeeApache2::Log.Apache2::Const::LOG_DEBUGβsince: 2.0.00β¨ SeeApache2::Log.Apache2::Const::LOG_EMERGβsince: 2.0.00β¨ SeeApache2::Log.Apache2::Const::LOG_ERRβsince: 2.0.00β¨ SeeApache2::Log.Apache2::Const::LOG_INFOβsince: 2.0.00β¨ SeeApache2::Log.Apache2::Const::LOG_LEVELMASKβsince: 2.0.00β¨ SeeApache2::Log.Apache2::Const::LOG_NOTICEβsince: 2.0.00β¨ SeeApache2::Log.Apache2::Const::LOG_STARTUPβsince: 2.0.00β¨ SeeApache2::Log.Apache2::Const::LOG_TOCLIENTβsince: 2.0.00β¨ SeeApache2::Log.Apache2::Const::LOG_WARNING- and yeah, that one's
since: 2.0.00too, obvs π
Anyway β for the full tea on that group, go read Apache2::Log. It's right there, bestie π«Ά
β¨ the :methods group β¨
use Apache2::Const -compile => qw(:methods);
These ones go hand in hand with $r->method_number β like, that's their whole thing π
Apache2::Const::METHODSβ since: 2.0.00Apache2::Const::M_BASELINE_CONTROLβ since: 2.0.00Apache2::Const::M_CHECKINβ since: 2.0.00Apache2::Const::M_CHECKOUTβ since: 2.0.00Apache2::Const::M_CONNECTβ since: 2.0.00Apache2::Const::M_COPYβ since: 2.0.00Apache2::Const::M_DELETEβ since: 2.0.00Apache2::Const::M_GETβ since: 2.0.00 β this one corresponds to the HTTPGETmethod πApache2::Const::M_INVALIDβ since: 2.0.00Apache2::Const::M_LABELβ since: 2.0.00Apache2::Const::M_LOCKβ since: 2.0.00Apache2::Const::M_MERGEβ since: 2.0.00Apache2::Const::M_MKACTIVITYβ since: 2.0.00Apache2::Const::M_MKCOLβ since: 2.0.00Apache2::Const::M_MKWORKSPACEβ since: 2.0.00Apache2::Const::M_MOVEβ since: 2.0.00Apache2::Const::M_OPTIONSβ since: 2.0.00Apache2::Const::M_PATCHβ since: 2.0.00Apache2::Const::M_POSTβ since: 2.0.00 β corresponds to the HTTPPOSTmethod, slay πApache2::Const::M_PROPFINDβ since: 2.0.00Apache2::Const::M_PROPPATCHβ since: 2.0.00Apache2::Const::M_PUTβ since: 2.0.00 β corresponds to the HTTPPUTmethod, periodt π₯Apache2::Const::M_REPORTβ since: 2.0.00Apache2::Const::M_TRACEβ since: 2.0.00Apache2::Const::M_UNCHECKOUTβ since: 2.0.00Apache2::Const::M_UNLOCKβ since: 2.0.00Apache2::Const::M_UPDATEβ since: 2.0.00Apache2::Const::M_VERSION_CONTROLβ since: 2.0.00
πΈ the :mpmq group πΈ
use Apache2::Const -compile => qw(:mpmq);
This whole group is for querying MPM properties β like asking your server "bestie, how are you built?" π§
Apache2::Const::MPMQ_NOT_SUPPORTEDβ since: 2.0.00Apache2::Const::MPMQ_STATICβ since: 2.0.00Apache2::Const::MPMQ_DYNAMICβ since: 2.0.00Apache2::Const::MPMQ_MAX_DAEMON_USEDβ since: 2.0.00Apache2::Const::MPMQ_IS_THREADEDβ since: 2.0.00Apache2::Const::MPMQ_IS_FORKEDβ since: 2.0.00Apache2::Const::MPMQ_HARD_LIMIT_DAEMONSβ since: 2.0.00Apache2::Const::MPMQ_HARD_LIMIT_THREADSβ since: 2.0.00Apache2::Const::MPMQ_MAX_THREADSβ since: 2.0.00Apache2::Const::MPMQ_MIN_SPARE_DAEMONSβ since: 2.0.00Apache2::Const::MPMQ_MIN_SPARE_THREADSβ since: 2.0.00Apache2::Const::MPMQ_MAX_SPARE_DAEMONSβ since: 2.0.00Apache2::Const::MPMQ_MAX_SPARE_THREADSβ since: 2.0.00Apache2::Const::MPMQ_MAX_REQUESTS_DAEMONβ since: 2.0.00Apache2::Const::MPMQ_MAX_DAEMONSβ since: 2.0.00
π¦ the :options group π¦
use Apache2::Const -compile => qw(:options);
These constants mirror the Options configuration directive, fr fr. Want actual examples? Peep $r->allow_options π
Apache2::Const::OPT_ALLβ since: 2.0.00Apache2::Const::OPT_EXECCGIβ since: 2.0.00Apache2::Const::OPT_INCLUDESβ since: 2.0.00Apache2::Const::OPT_INCNOEXECβ since: 2.0.00Apache2::Const::OPT_INDEXESβ since: 2.0.00Apache2::Const::OPT_MULTIβ since: 2.0.00Apache2::Const::OPT_NONEβ since: 2.0.00Apache2::Const::OPT_SYM_LINKSβ since: 2.0.00Apache2::Const::OPT_SYM_OWNERβ since: 2.0.00Apache2::Const::OPT_UNSETβ since: 2.0.00
π the :override group π
use Apache2::Const -compile => qw(:override);
Same deal but for the AllowOverride configuration directive. Examples? Again: $r->allow_options π
Apache2::Const::ACCESS_CONFβ*.confinside<Directory>or<Location>β since: 2.0.00Apache2::Const::EXEC_ON_READβ forces a directive to execute a command that would modify the configuration (like including another file, orIFModule) β since: 2.0.00Apache2::Const::OR_ALLβ this icon is literally the combo ofApache2::Const::OR_LIMIT|Apache2::Const::OR_OPTIONS|Apache2::Const::OR_FILEINFO|Apache2::Const::OR_AUTHCFG|Apache2::Const::OR_INDEXESβ since: 2.0.00Apache2::Const::OR_AUTHCFGβ*.confinside<Directory>or<Location>, plus.htaccesswhenAllowOverride AuthConfigβ since: 2.0.00Apache2::Const::OR_FILEINFOβ*.confanywhere, and.htaccesswhenAllowOverride FileInfoβ since: 2.0.00Apache2::Const::OR_INDEXESβ*.confanywhere, and.htaccesswhenAllowOverride Indexesβ since: 2.0.00Apache2::Const::OR_LIMITβ*.confinside<Directory>or<Location>, plus.htaccesswhenAllowOverride Limitβ since: 2.0.00Apache2::Const::OR_NONEβ*.confis not available anywhere in this override β since: 2.0.00Apache2::Const::OR_OPTIONSβ*.confanywhere, and.htaccesswhenAllowOverride Optionsβ since: 2.0.00Apache2::Const::OR_UNSETβ unsets a directive (inAllow) β since: 2.0.00Apache2::Const::RSRC_CONFβ*.confoutside<Directory>or<Location>β since: 2.0.00
π the :platform group π
use Apache2::Const -compile => qw(:platform);
These are the "it depends on your OS bestie" constants β genuinely varies from OS to OS π«Ά
Apache2::Const::CRLFβ since: 2.0.00Apache2::Const::CRβ since: 2.0.00Apache2::Const::LFβ since: 2.0.00
β the :remotehost group β
use Apache2::Const -compile => qw(:remotehost);
(okay the original says "is is used by", and we are not fixing it, we're just appreciating it π) β these get used by the $c->get_remote_host method.
Apache2::Const::REMOTE_DOUBLE_REVβ since: 2.0.00Apache2::Const::REMOTE_HOSTβ since: 2.0.00Apache2::Const::REMOTE_NAMEβ since: 2.0.00Apache2::Const::REMOTE_NOLOOKUPβ since: 2.0.00
π the :satisfy group π
use Apache2::Const -compile => qw(:satisfy);
Buddies with $r->satisfies. It's giving "are we satisfied or not" energy β¨
Apache2::Const::SATISFY_ALLβ since: 2.0.00 β every single requirement has to be met, no skipping πApache2::Const::SATISFY_ANYβ since: 2.0.00 β any one of the requirements must be metApache2::Const::SATISFY_NOSPECβ since: 2.0.00 β there are no applicable satisfy lines
π₯ the :types group π₯
use Apache2::Const -compile => qw(:types);
Yep, the original literally calls these "XXX constants" and we're keeping that exactly as-is ππ
Apache2::Const::DIR_MAGIC_TYPEβ since: 2.0.00
π the :proxy group π
use Apache2::Const -compile => qw(:proxy);
These live for $r->proxyreq β proxy vibes only π
Apache2::Const::PROXYREQ_NONEβ since: 2.0.2Apache2::Const::PROXYREQ_PROXYβ since: 2.0.2Apache2::Const::PROXYREQ_REVERSEβ since: 2.0.2Apache2::Const::PROXYREQ_RESPONSEβ since: 2.0.5
π¦ See Also π¦
- mod_perl 2.0 documentation.
- HTTP Status Codes.
π 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.
okay that's the whole page bestie, go forth and constant-ify β¨ this was perl v5.42.3, dated 2023-10-21, page docs::a...2::Const(3) β main character documentation energy, no cap ππ
π¦ where this page comes from
- nixos 26.05: mod_perl 2.0.13
- nixpkgs unstable: mod_perl 2.0.13
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms