mod_perl logo perl icon
previous page: Apache2::ConnectionUtil - Perl API for Apache connection utilspage up: mod_perl 2.0 APInext page: Apache2::Directive - Perl API for manipulating the Apache configuration tree

Apache2::Const - Perl Interface for Apache Constants






mod_perl2 User's Guide

mod_perl2 User's Guide

By Stas Bekman, Jim Brandt
Practical mod_perl

Practical mod_perl

By Stas Bekman, Eric Cholet
The mod_perl Developer's Cookbook

The mod_perl Developer's Cookbook

By Geoffrey Young, Paul Lindner, Randy Kobes
mod_perl Pocket Reference

mod_perl Pocket Reference

By Andrew Ford
Writing Apache Modules with Perl and C

Writing Apache Modules with Perl and C

By Lincoln Stein, Doug MacEachern
Embedding Perl in HTML with Mason

Embedding Perl in HTML with Mason

By Dave Rolsky, Ken Williams


Table of Contents

Synopsis

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


TOP

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

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


TOP

Constants



TOP

:cmd_how

  use Apache2::Const -compile => qw(:cmd_how);

The :cmd_how constants group is used in Apache2::Module::add() and $cmds->args_how.



TOP

Apache2::Const::FLAG

One of On or Off (full description).



TOP

Apache2::Const::ITERATE

One argument, occuring multiple times (full description).



TOP

Apache2::Const::ITERATE2

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



TOP

Apache2::Const::NO_ARGS

No arguments at all (full description).



TOP

Apache2::Const::RAW_ARGS

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



TOP

Apache2::Const::TAKE1

One argument only (full description).



TOP

Apache2::Const::TAKE12

One or two arguments (full description).



TOP

Apache2::Const::TAKE123

One, two or three arguments (full description).



TOP

Apache2::Const::TAKE13

One or three arguments (full description).



TOP

Apache2::Const::TAKE2

Two arguments (full description).



TOP

Apache2::Const::TAKE23

Two or three arguments (full description).



TOP

Apache2::Const::TAKE3

Three arguments (full description).



TOP

:common

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

The :common group is for XXX constants.



TOP

Apache2::Const::AUTH_REQUIRED



TOP

Apache2::Const::DECLINED



TOP

Apache2::Const::DONE



TOP

Apache2::Const::FORBIDDEN



TOP

Apache2::Const::NOT_FOUND



TOP

Apache2::Const::OK



TOP

Apache2::Const::REDIRECT



TOP

Apache2::Const::SERVER_ERROR



TOP

:config

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

The :config group is for XXX constants.



TOP

Apache2::Const::DECLINE_CMD



TOP

:conn_keepalive

  use Apache2::Const -compile => qw(:conn_keepalive);

The :conn_keepalive constants group is used by the ($c->keepalive) method.



TOP

Apache2::Const::CONN_CLOSE

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



TOP

Apache2::Const::CONN_KEEPALIVE

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



TOP

Apache2::Const::CONN_UNKNOWN

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



TOP

:context

  use Apache2::Const -compile => qw(:context);

The :context group is used by the $parms->check_cmd_context method.



TOP

Apache2::Const::NOT_IN_VIRTUALHOST

The command is not in a <VirtualHost> block.



TOP

Apache2::Const::NOT_IN_LIMIT

The command is not in a <Limit> block.



TOP

Apache2::Const::NOT_IN_DIRECTORY

The command is not in a <Directory> block.



TOP

Apache2::Const::NOT_IN_LOCATION

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



TOP

Apache2::Const::NOT_IN_FILES

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



TOP

Apache2::Const::NOT_IN_DIR_LOC_FILE

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



TOP

Apache2::Const::GLOBAL_ONLY

The directive appears outside of any container directives.



TOP

:filter_type

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

The :filter_type group is for XXX constants.



TOP

Apache2::Const::FTYPE_CONNECTION



TOP

Apache2::Const::FTYPE_CONTENT_SET



TOP

Apache2::Const::FTYPE_NETWORK



TOP

Apache2::Const::FTYPE_PROTOCOL



TOP

Apache2::Const::FTYPE_RESOURCE



TOP

Apache2::Const::FTYPE_TRANSCODE



TOP

:http

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

The :http group is for XXX constants.



TOP

Apache2::Const::HTTP_ACCEPTED



TOP

Apache2::Const::HTTP_BAD_GATEWAY



TOP

Apache2::Const::HTTP_BAD_REQUEST



TOP

Apache2::Const::HTTP_CONFLICT



TOP

Apache2::Const::HTTP_CONTINUE



TOP

Apache2::Const::HTTP_CREATED



TOP

Apache2::Const::HTTP_EXPECTATION_FAILED



TOP

Apache2::Const::HTTP_FAILED_DEPENDENCY



TOP

Apache2::Const::HTTP_FORBIDDEN



TOP

Apache2::Const::HTTP_GATEWAY_TIME_OUT



TOP

Apache2::Const::HTTP_GONE



TOP

Apache2::Const::HTTP_INSUFFICIENT_STORAGE



TOP

Apache2::Const::HTTP_INTERNAL_SERVER_ERROR



TOP

Apache2::Const::HTTP_LENGTH_REQUIRED



TOP

Apache2::Const::HTTP_LOCKED



TOP

Apache2::Const::HTTP_METHOD_NOT_ALLOWED



TOP

Apache2::Const::HTTP_MOVED_PERMANENTLY



TOP

Apache2::Const::HTTP_MOVED_TEMPORARILY



TOP

Apache2::Const::HTTP_MULTIPLE_CHOICES



TOP

Apache2::Const::HTTP_MULTI_STATUS



TOP

Apache2::Const::HTTP_NON_AUTHORITATIVE



TOP

Apache2::Const::HTTP_NOT_ACCEPTABLE



TOP

Apache2::Const::HTTP_NOT_EXTENDED



TOP

Apache2::Const::HTTP_NOT_FOUND



TOP

Apache2::Const::HTTP_NOT_IMPLEMENTED



TOP

Apache2::Const::HTTP_NOT_MODIFIED



TOP

Apache2::Const::HTTP_NO_CONTENT



TOP

Apache2::Const::HTTP_OK



TOP

Apache2::Const::HTTP_PARTIAL_CONTENT



TOP

Apache2::Const::HTTP_PAYMENT_REQUIRED



TOP

Apache2::Const::HTTP_PRECONDITION_FAILED



TOP

Apache2::Const::HTTP_PROCESSING



TOP

Apache2::Const::HTTP_PROXY_AUTHENTICATION_REQUIRED



TOP

Apache2::Const::HTTP_RANGE_NOT_SATISFIABLE



TOP

Apache2::Const::HTTP_REQUEST_ENTITY_TOO_LARGE



TOP

Apache2::Const::HTTP_REQUEST_TIME_OUT



TOP

Apache2::Const::HTTP_REQUEST_URI_TOO_LARGE



TOP

Apache2::Const::HTTP_RESET_CONTENT



TOP

Apache2::Const::HTTP_SEE_OTHER



TOP

Apache2::Const::HTTP_SERVICE_UNAVAILABLE



TOP

Apache2::Const::HTTP_SWITCHING_PROTOCOLS



TOP

Apache2::Const::HTTP_TEMPORARY_REDIRECT



TOP

Apache2::Const::HTTP_UNAUTHORIZED



TOP

Apache2::Const::HTTP_UNPROCESSABLE_ENTITY



TOP

Apache2::Const::HTTP_UNSUPPORTED_MEDIA_TYPE



TOP

Apache2::Const::HTTP_UPGRADE_REQUIRED



TOP

Apache2::Const::HTTP_USE_PROXY



TOP

Apache2::Const::HTTP_VARIANT_ALSO_VARIES



TOP

:input_mode

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

The :input_mode group is used by get_brigade.



TOP

Apache2::Const::MODE_EATCRLF

See Apache2::Filter::get_brigade().



TOP

Apache2::Const::MODE_EXHAUSTIVE

See Apache2::Filter::get_brigade().



TOP

Apache2::Const::MODE_GETLINE

See Apache2::Filter::get_brigade().



TOP

Apache2::Const::MODE_INIT

See Apache2::Filter::get_brigade().



TOP

Apache2::Const::MODE_READBYTES

See Apache2::Filter::get_brigade().



TOP

Apache2::Const::MODE_SPECULATIVE

See Apache2::Filter::get_brigade().



TOP

:log

  use Apache2::Const -compile => qw(:log);

The :log group is for constants used by Apache2::Log.



TOP

Apache2::Const::LOG_ALERT

See Apache2::Log.



TOP

Apache2::Const::LOG_CRIT

See Apache2::Log.



TOP

Apache2::Const::LOG_DEBUG

See Apache2::Log.



TOP