libapa...:Const(3pm)
π NAME π
Apache2::Const β the Perl Interface for Apache Constants, aka your little box of magic Apache words π
β¨ Synopsis β¨
okay so here's the three whole vibes you can roll with π
# 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 basically a lil treasure chest of constants that are specific to Apache features. π«Ά
so here's the tea bestie: mod_perl 2.0 ships with several hundreds of constants, and you do not want all of them dumped into your Perl code by default, because that's a whole CPU and memory overhead situation π. So instead, when you want a specific constant, you have to explicitly ask for it to be made available. icon behavior honestly.
for example, this code right here:
use Apache2::Const -compile => qw(FORBIDDEN OK);
makes the constants Apache2::Const::FORBIDDEN and Apache2::Const::OK available to your code β but they are not imported. which means you have to use the fully qualified constant, like so:
return Apache2::Const::OK;
BUT if you drop the -compile argument and write:
use Apache2::Const qw(FORBIDDEN OK);
then both constants get imported straight into your code's namespace and you can use them standalone, like:
return OK;
ngl, both of these are kinda a lot... first because importing symbols means extra memory requirements, and second because there are constants in other namespaces (like APR:: and ModPerl::, plus non-mod_perl modules) that might contain the exact same names π. so importing constants is not recommended. basically, you want the -compile construct. periodt.
finally, a lil Perl moment: in Perl, => is almost the same as the comma operator. it's syntax sugar that makes it way clearer when there's a key-value relation between two arguments, and it also auto-parses its lefthand argument (the key) as a string, so you don't even need to quote it. slay.
and if that syntax isn't your vibe, instead of writing:
use Apache2::Const -compile => qw(FORBIDDEN OK);
you could write:
use Apache2::Const "-compile", qw(FORBIDDEN OK);
and for the parentheses-lovers out there π:
use Apache2::Const ("-compile", qw(FORBIDDEN OK));
π Constants π
:cmd_how
use Apache2::Const -compile => qw(:cmd_how);
The :cmd_how constants group is the one used by 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. π¦
Apache2::Const::AUTH_REQUIREDsince: 2.0.00Apache2::Const::DECLINEDsince: 2.0.00Apache2::Const::DONEsince: 2.0.00Apache2::Const::FORBIDDENsince: 2.0.00Apache2::Const::NOT_FOUNDsince: 2.0.00Apache2::Const::OKsince: 2.0.00Apache2::Const::REDIRECTsince: 2.0.00Apache2::Const::SERVER_ERRORsince: 2.0.00
:config
use Apache2::Const -compile => qw(:config);
The :config group is for XXX constants. π
Apache2::Const::DECLINE_CMDsince: 2.0.00
:conn_keepalive
use Apache2::Const -compile => qw(:conn_keepalive);
The :conn_keepalive constants group is the one 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_CONNECTIONsince: 2.0.00Apache2::Const::FTYPE_CONTENT_SETsince: 2.0.00Apache2::Const::FTYPE_NETWORKsince: 2.0.00Apache2::Const::FTYPE_PROTOCOLsince: 2.0.00Apache2::Const::FTYPE_RESOURCEsince: 2.0.00Apache2::Const::FTYPE_TRANSCODEsince: 2.0.00
:http
use Apache2::Const -compile => qw(:http);
The :http group is for XXX constants. β
Apache2::Const::HTTP_ACCEPTEDsince: 2.0.00Apache2::Const::HTTP_BAD_GATEWAYsince: 2.0.00Apache2::Const::HTTP_BAD_REQUESTsince: 2.0.00Apache2::Const::HTTP_CONFLICTsince: 2.0.00Apache2::Const::HTTP_CONTINUEsince: 2.0.00Apache2::Const::HTTP_CREATEDsince: 2.0.00Apache2::Const::HTTP_EXPECTATION_FAILEDsince: 2.0.00Apache2::Const::HTTP_FAILED_DEPENDENCYsince: 2.0.00Apache2::Const::HTTP_FORBIDDENsince: 2.0.00Apache2::Const::HTTP_GATEWAY_TIME_OUTsince: 2.0.00Apache2::Const::HTTP_GONEsince: 2.0.00Apache2::Const::HTTP_INSUFFICIENT_STORAGEsince: 2.0.00Apache2::Const::HTTP_INTERNAL_SERVER_ERRORsince: 2.0.00Apache2::Const::HTTP_LENGTH_REQUIREDsince: 2.0.00Apache2::Const::HTTP_LOCKEDsince: 2.0.00Apache2::Const::HTTP_METHOD_NOT_ALLOWEDsince: 2.0.00Apache2::Const::HTTP_MOVED_PERMANENTLYsince: 2.0.00Apache2::Const::HTTP_MOVED_TEMPORARILYsince: 2.0.00Apache2::Const::HTTP_MULTIPLE_CHOICESsince: 2.0.00Apache2::Const::HTTP_MULTI_STATUSsince: 2.0.00Apache2::Const::HTTP_NON_AUTHORITATIVEsince: 2.0.00Apache2::Const::HTTP_NOT_ACCEPTABLEsince: 2.0.00Apache2::Const::HTTP_NOT_EXTENDEDsince: 2.0.00Apache2::Const::HTTP_NOT_FOUNDsince: 2.0.00Apache2::Const::HTTP_NOT_IMPLEMENTEDsince: 2.0.00Apache2::Const::HTTP_NOT_MODIFIEDsince: 2.0.00Apache2::Const::HTTP_NO_CONTENTsince: 2.0.00Apache2::Const::HTTP_OKsince: 2.0.00Apache2::Const::HTTP_PARTIAL_CONTENTsince: 2.0.00Apache2::Const::HTTP_PAYMENT_REQUIREDsince: 2.0.00Apache2::Const::HTTP_PRECONDITION_FAILEDsince: 2.0.00Apache2::Const::HTTP_PROCESSINGsince: 2.0.00Apache2::Const::HTTP_PROXY_AUTHENTICATION_REQUIREDsince: 2.0.00Apache2::Const::HTTP_RANGE_NOT_SATISFIABLEsince: 2.0.00Apache2::Const::HTTP_REQUEST_ENTITY_TOO_LARGEsince: 2.0.00Apache2::Const::HTTP_REQUEST_TIME_OUTsince: 2.0.00Apache2::Const::HTTP_REQUEST_URI_TOO_LARGEsince: 2.0.00Apache2::Const::HTTP_RESET_CONTENTsince: 2.0.00Apache2::Const::HTTP_SEE_OTHERsince: 2.0.00Apache2::Const::HTTP_SERVICE_UNAVAILABLEsince: 2.0.00Apache2::Const::HTTP_SWITCHING_PROTOCOLSsince: 2.0.00Apache2::Const::HTTP_TEMPORARY_REDIRECTsince: 2.0.00Apache2::Const::HTTP_UNAUTHORIZEDsince: 2.0.00Apache2::Const::HTTP_UNPROCESSABLE_ENTITYsince: 2.0.00Apache2::Const::HTTP_UNSUPPORTED_MEDIA_TYPEsince: 2.0.00Apache2::Const::HTTP_UPGRADE_REQUIREDsince: 2.0.00Apache2::Const::HTTP_USE_PROXYsince: 2.0.00Apache2::Const::HTTP_VARIANT_ALSO_VARIESsince: 2.0.00
:input_mode
use Apache2::Const -compile => qw(:input_mode);
The :input_mode group is used by get_brigade. π
Apache2::Const::MODE_EATCRLFsince: 2.0.00
See Apache2::Filter::get_brigade().
Apache2::Const::MODE_EXHAUSTIVEsince: 2.0.00
See Apache2::Filter::get_brigade().
Apache2::Const::MODE_GETLINEsince: 2.0.00
See Apache2::Filter::get_brigade().
Apache2::Const::MODE_INITsince: 2.0.00
See Apache2::Filter::get_brigade().
Apache2::Const::MODE_READBYTESsince: 2.0.00
See Apache2::Filter::get_brigade().
Apache2::Const::MODE_SPECULATIVEsince: 2.0.00
See Apache2::Filter::get_brigade().
:log
use Apache2::Const -compile => qw(:log);
The :log group is for constants used by Apache2::Log. π
Apache2::Const::LOG_ALERTsince: 2.0.00
See Apache2::Log.
Apache2::Const::LOG_CRITsince: 2.0.00
See Apache2::Log.
Apache2::Const::LOG_DEBUGsince: 2.0.00
See Apache2::Log.
Apache2::Const::LOG_EMERGsince: 2.0.00
See Apache2::Log.
Apache2::Const::LOG_ERRsince: 2.0.00
See Apache2::Log.
Apache2::Const::LOG_INFOsince: 2.0.00
See Apache2::Log.
Apache2::Const::LOG_LEVELMASKsince: 2.0.00
See Apache2::Log.
Apache2::Const::LOG_NOTICEsince: 2.0.00
See Apache2::Log.
Apache2::Const::LOG_STARTUPsince: 2.0.00
See Apache2::Log.
Apache2::Const::LOG_TOCLIENTsince: 2.0.00
See Apache2::Log.
Apache2::Const::LOG_WARNING
since: 2.0.00 β¨ and yep, that one's all documented over in Apache2::Log β go peek bestie π
π :methods π
use Apache2::Const -compile => qw(:methods);
okay so the :methods constant group is the one you pull in when you're doing stuff with $r->method_number π«Ά like, they're a set, you use them together, that's the vibe.
Apache2::Const::METHODSβ since: 2.0.00 πΈApache2::Const::M_BASELINE_CONTROLβ since: 2.0.00 πΈApache2::Const::M_CHECKINβ since: 2.0.00 πΈApache2::Const::M_CHECKOUTβ since: 2.0.00 πΈApache2::Const::M_CONNECTβ since: 2.0.00 πΈApache2::Const::M_COPYβ since: 2.0.00 πΈApache2::Const::M_DELETEβ since: 2.0.00 πΈApache2::Const::M_GETβ since: 2.0.00 πΈ β this one is the HTTPGETmethod, the one you already know and love πApache2::Const::M_INVALIDβ since: 2.0.00 πΈApache2::Const::M_LABELβ since: 2.0.00 πΈApache2::Const::M_LOCKβ since: 2.0.00 πΈApache2::Const::M_MERGEβ since: 2.0.00 πΈApache2::Const::M_MKACTIVITYβ since: 2.0.00 πΈApache2::Const::M_MKCOLβ since: 2.0.00 πΈApache2::Const::M_MKWORKSPACEβ since: 2.0.00 πΈApache2::Const::M_MOVEβ since: 2.0.00 πΈApache2::Const::M_OPTIONSβ since: 2.0.00 πΈApache2::Const::M_PATCHβ since: 2.0.00 πΈApache2::Const::M_POSTβ since: 2.0.00 πΈ β and this is the HTTPPOSTmethod, iconic behavior truly πApache2::Const::M_PROPFINDβ since: 2.0.00 πΈApache2::Const::M_PROPPATCHβ since: 2.0.00 πΈApache2::Const::M_PUTβ since: 2.0.00 πΈ β the HTTPPUTmethod, slay πApache2::Const::M_REPORTβ since: 2.0.00 πΈApache2::Const::M_TRACEβ since: 2.0.00 πΈApache2::Const::M_UNCHECKOUTβ since: 2.0.00 πΈApache2::Const::M_UNLOCKβ since: 2.0.00 πΈApache2::Const::M_UPDATEβ since: 2.0.00 πΈApache2::Const::M_VERSION_CONTROLβ since: 2.0.00 πΈ
π¦ :mpmq π¦
use Apache2::Const -compile => qw(:mpmq);
the :mpmq group?? okay so this is your little toolkit for querying MPM properties β like asking your server "bestie, how are you built? thread-y? fork-y? how many of you are there?" β¨
Apache2::Const::MPMQ_NOT_SUPPORTEDβ since: 2.0.00 πApache2::Const::MPMQ_STATICβ since: 2.0.00 πApache2::Const::MPMQ_DYNAMICβ since: 2.0.00 πApache2::Const::MPMQ_MAX_DAEMON_USEDβ since: 2.0.00 πApache2::Const::MPMQ_IS_THREADEDβ since: 2.0.00 πApache2::Const::MPMQ_IS_FORKEDβ since: 2.0.00 πApache2::Const::MPMQ_HARD_LIMIT_DAEMONSβ since: 2.0.00 πApache2::Const::MPMQ_HARD_LIMIT_THREADSβ since: 2.0.00 πApache2::Const::MPMQ_MAX_THREADSβ since: 2.0.00 πApache2::Const::MPMQ_MIN_SPARE_DAEMONSβ since: 2.0.00 πApache2::Const::MPMQ_MIN_SPARE_THREADSβ since: 2.0.00 πApache2::Const::MPMQ_MAX_SPARE_DAEMONSβ since: 2.0.00 πApache2::Const::MPMQ_MAX_SPARE_THREADSβ since: 2.0.00 πApache2::Const::MPMQ_MAX_REQUESTS_DAEMONβ since: 2.0.00 πApache2::Const::MPMQ_MAX_DAEMONSβ since: 2.0.00 π
π :options π
use Apache2::Const -compile => qw(:options);
so the :options group is literally the constants that match up with the Options configuration directive β¨ you want examples? go look at $r->allow_options, they got you π«Ά
Apache2::Const::OPT_ALLβ since: 2.0.00 πΈApache2::Const::OPT_EXECCGIβ since: 2.0.00 πΈApache2::Const::OPT_INCLUDESβ since: 2.0.00 πΈApache2::Const::OPT_INCNOEXECβ since: 2.0.00 πΈApache2::Const::OPT_INDEXESβ since: 2.0.00 πΈApache2::Const::OPT_MULTIβ since: 2.0.00 πΈApache2::Const::OPT_NONEβ since: 2.0.00 πΈApache2::Const::OPT_SYM_LINKSβ since: 2.0.00 πΈApache2::Const::OPT_SYM_OWNERβ since: 2.0.00 πΈApache2::Const::OPT_UNSETβ since: 2.0.00 πΈ
π
:override π
use Apache2::Const -compile => qw(:override);
okay the :override group is the constants for the AllowOverride configuration directive π and fr, if you want examples just go see $r->allow_options, it's right there.
Apache2::Const::ACCESS_CONFβ the*.confinside<Directory>or<Location>β since: 2.0.00 πApache2::Const::EXEC_ON_READβ force a directive to execute a command that would modify the configuration (like including another file, orIFModule) β since: 2.0.00 πApache2::Const::OR_ALLβ it'sApache2::Const::OR_LIMIT|Apache2::Const::OR_OPTIONS|Apache2::Const::OR_FILEINFO|Apache2::Const::OR_AUTHCFG|Apache2::Const::OR_INDEXESβ since: 2.0.00 πApache2::Const::OR_AUTHCFGβ*.confinside<Directory>or<Location>and.htaccesswhenAllowOverride AuthConfigβ since: 2.0.00 πApache2::Const::OR_FILEINFOβ*.confanywhere and.htaccesswhenAllowOverride FileInfoβ since: 2.0.00 πApache2::Const::OR_INDEXESβ*.confanywhere and.htaccesswhenAllowOverride Indexesβ since: 2.0.00 πApache2::Const::OR_LIMITβ*.confinside<Directory>or<Location>and.htaccesswhenAllowOverride Limitβ since: 2.0.00 πApache2::Const::OR_NONEβ*.confis not available anywhere in this override β since: 2.0.00 πApache2::Const::OR_OPTIONSβ*.confanywhere and.htaccesswhenAllowOverride Optionsβ since: 2.0.00 πApache2::Const::OR_UNSETβ unset a directive (inAllow) β since: 2.0.00 πApache2::Const::RSRC_CONFβ*.confoutside<Directory>or<Location>β since: 2.0.00 π
π§ :platform π§
use Apache2::Const -compile => qw(:platform);
the :platform group is for constants that might differ from OS to OS π so like, your mileage may literally vary depending on the machine you're on, and that's the point of them.
Apache2::Const::CRLFβ since: 2.0.00 πΈApache2::Const::CRβ since: 2.0.00 πΈApache2::Const::LFβ since: 2.0.00 πΈ
π :remotehost π
use Apache2::Const -compile => qw(:remotehost);
the :remotehost constants group (yes the original says "is is", we stan a typo, but it's fine) gets used by the $c->get_remote_host method π you bring these along whenever you're asking about where somebody's connecting from.
Apache2::Const::REMOTE_DOUBLE_REVβ since: 2.0.00 πΈApache2::Const::REMOTE_HOSTβ since: 2.0.00 πΈApache2::Const::REMOTE_NAMEβ since: 2.0.00 πΈApache2::Const::REMOTE_NOLOOKUPβ since: 2.0.00 πΈ
β :satisfy β
use Apache2::Const -compile => qw(:satisfy);
the :satisfy constants group is the buddy of $r->satisfies π«Ά like, it answers "did we do enough to let this request through or nah?"
Apache2::Const::SATISFY_ALLβ since: 2.0.00 πΈ β all of the requirements must be met π₯Apache2::Const::SATISFY_ANYβ since: 2.0.00 πΈ β any of the requirements must be met π« (yes, lowercase "any" in the original, we keep it, it's cute)Apache2::Const::SATISFY_NOSPECβ since: 2.0.00 πΈ β there are no applicable satisfy lines π«
π :types π
use Apache2::Const -compile => qw(:types);
the :types group is for XXX constants π like, that's literally what the docs say. XXX. we don't ask questions, we just import the group bestie.
Apache2::Const::DIR_MAGIC_TYPEβ since: 2.0.00 πΈ
π :proxy π
use Apache2::Const -compile => qw(:proxy);
the :proxy constants group hangs out with $r->proxyreq β¨ perfect for when you need to know if a request is a proxy request and which flavor of proxy it is.
Apache2::Const::PROXYREQ_NONEβ since: 2.0.2 π¦Apache2::Const::PROXYREQ_PROXYβ since: 2.0.2 π¦Apache2::Const::PROXYREQ_REVERSEβ since: 2.0.2 π¦Apache2::Const::PROXYREQ_RESPONSEβ since: 2.0.5 π¦ (yes bestie, a different version number, don't @ me, that's just what it says)
πΈ SEE ALSO (but make it a vibe) πΈ
- mod_perl 2.0 documentation β go read it, it's giving scholarly π
- HTTP Status Codes β also a read, also important, no cap π
π Copyright π
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0 βοΈ (yes we're being serious here, credit where credit's due, always)
π Authors π
The mod_perl development team and numerous contributors ππ legendary behavior, honestly, they ate and left no crumbs.
okay and for the lil sign-off moment: this whole page is perl v5.42.3, dated 2026-08-20, and it's libapa...:Const(3pm) β the user contributed Perl documentation, Perl version 5.42.3, dated 2026-08-20 π«Ά that's the footer, that's the tea, go forth and import your constants bestie β¨π
π¦ where this page comes from
- ubuntu stonking: libapache2-mod-perl2 2.0.13-2build3 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms