logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

APR::Request - wrapper for libapreq2's module/handle API.

Description

       The "APR::Request" module provides the base methods for interfacing with libapreq2's module API.  It also
       provides a few utility functions and constants.

       This manpage documents version 2.17 of the APR::Request, APR::Request::Custom,
       APR::Request::Cookie::Table, and APR::Request::Param::Table packages.

Methods

       APR::Request::Param::Table

   param_class
           $table->param_class()
           $table->param_class($set)

       Get/set the class each table element is blessed into during a "get" or "FETCH" call.  If defined, the
       class must be derived from APR::Request::Param.  When called with $set, it returns the $table.  Otherwise
       it returns the name of the current class, or undef if no param class is defined.

   get
           $table->get($key)

       Same as FETCH.

   FETCH
           $table->FETCH($key)

       In scalar context, this returns the first value matching $key (see NEXTKEY for additional notes on this).
       The match is always case-insensitive.  In list context, this returns all matching values.  Note: the type
       of the return values depends on the table's current param_class.

   EXISTS
       Synonym for "defined"; these tables are not allowed to contain undefined values. Since these are constant
       tables, they don't autovivify either.

   NEXTKEY
           $table->NEXTKEY()

       Returns the next key in the table.  For perl 5.8+, if the key is multivalued, a subsequent FETCH on this
       key will return the corresponding value, until either NEXTKEY or FIRSTKEY is invoked again.  For perl
       5.6, FETCH always returns the first value.

   FIRSTKEY
           $table->FIRSTKEY()

       Returns the first key in the table.

   do
           $table->do($callback, @keys)

       Same as APR::Table::do; iterates over the table calling $callback->($key, $value) for each matching
       @keys.  If @keys is empty, this iterates over the entire table.

       Note: The type of $value inserted into the callback depends on the table's current value_class.

Name

       APR::Request - wrapper for libapreq2's module/handle API.

See Also

       APR::Request::Error, APR::Request::Param, APR::Request::Cookie, APR::Request::Parser

Subclassing

       APR::Request

       If the instances of your subclass are hash references then you can actually inherit from APR::Request as
       long as the APR::Request object is stored in an attribute called "r" or "_r". (The APR::Request class
       effectively does the delegation for you automagically, as long as it knows where to find the APR::Request
       object to delegate to.)  For example:

               package MySubClass;
               use APR::Request::Custom;
               our @ISA = qw(APR::Request);
               sub new {
                   my($class, @args) = @_;
                   return bless { r => APR::Request::Custom->handle(@args) }, $class;
               }

Subroutines

       APR::Request

   encode
           encode($string)

       Exportable sub which returns the url-encoded form of $string.

   decode
           decode($string)

       Exportable sub which returns the url-decoded form of $string.

Synopsis

         use APR::Request;

         $req = APR::Request::Custom->handle($pool,
                                             "foo=arg1&bar=arg2",
                                             "apache=quux",
                                              $parser, 1e6, $bb);
         $param = $req->param("foo");
         $cookie = $req->jar("apache");

See Also