Apache2-API

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    "decode" in APR::Request

  decode_utf8( $data )
    Decode some data from ut8 into perl internal utf8 representation using
    Encode

    If an error occurs, it will return undef and set an exception that can
    be accessed with the error method.

  encode_base64( $data )
    Given some data, this will encode it using base64 algorithm. It uses
    "encode" in APR::Base64.

  encode_json( $hash_reference )
    Given a hash reference, this will encode it into a json data
    representation.

    However, this will not utf8 encode it, because this is done upon
    printing the data and returning it to the client.

    The JSON object has the following properties enabled: "allow_nonref",
    "allow_blessed", "convert_blessed" and "relaxed"

  encode_url( $string )
    Given a string, this returns its url-encoded version using "encode" in
    APR::Request

  encode_utf8( $data )
    This encode in ut8 the data provided and return it.

    If an error occurs, it will return undef and set an exception that can
    be accessed with the error method.

  generate_uuid
    Generates an uuid string and return it. This uses APR::UUID

  get_auth_bearer
    Checks whether an "Authorization" HTTP header was provided, and get the
    Bearer value.

    If no header was found, it returns an empty string.

    If an error occurs, it will return undef and set an exception that can
    be accessed with the error method.

  get_handlers
    Returns a reference to a list of handlers enabled for a given phase.

        $handlers_list = $res->get_handlers( $hook_name );

    A list of handlers configured to run at the child_exit phase:

        @handlers = @{ $res->get_handlers( 'PerlChildExitHandler' ) || []};

  gettext( 'string id' )
    Get the localised version of the string passed as an argument.

    This is supposed to be superseded by the package inheriting from
    Apache2::API, if any.

  header_datetime( DateTime object )
    Given a DateTime object, this sets it to GMT time zone and set the
    proper formatter (Apache2::API::DateTime) so that the stringification is
    compliant with HTTP headers standard.

  htpasswd
        my $ht = $api->htpasswd( $clear_password, create => 1 );
        my $ht = $api->htpasswd( $clear_password, create => 1, salt => $salt );
        my $ht = $api->htpasswd( $md5_password );
        my $bool = $ht->matches( $user_input_password );

    This instantiates a new Apache2::API::Password object by providing its
    constructor whatever arguments was received.

    It returns a new Apache2::API::Password object, or, upon error, "undef"
    in scalar context, or an empty list in list context.

  is_perl_option_enabled
    Checks if perl option is enabled in the Virtual Host and returns a
    boolean value

  json
    Returns a JSON object.

    You can provide an optional hash or hash reference of properties to
    enable or disable:

        my $J = $api->json( pretty => 1, relaxed => 1 );

    Each property corresponds to one that is supported by JSON

    It also supports "ordered", "order" and "sort" as an alias to
    "canonical"

  lang( $string )
    Set or get the language for the API. This would typically be the HTTP
    preferred language.

  lang_unix( $string )
    Given a language, this returns a language code formatted the unix way,
    ie en-GB would become en_GB

  lang_web( $string )
    Given a language, this returns a language code formatted the web way, ie
    en_GB would become en-GB

  log
        $api->log->emerg( "Urgent message." );
        $api->log->alert( "Alert!" );
        $api->log->crit( "Critical message." );
        $api->log->error( "Error message." );
        $api->log->warn( "Warning..." );
        $api->log->notice( "You should know." );
        $api->log->info( "This is for your information." );
        $api->log->debug( "This is debugging message." );

    Returns a Apache2::Log::Request object.

  log_error( $string )
    Given a string, this will log the data into the error log.

    When log_error is accessed with the Apache2::RequestRec the error gets
    logged into the Virtual Host log, but when log_error gets accessed via

README  view on Meta::CPAN

        add headers to (get|post|head) request

    "-help"
        display this message

    "-http11"
        run all tests with "HTTP/1.1" (keep alive) requests

    "-no-httpd"
        run the tests without configuring or starting httpd

    "-one-process"
        run the server in single process mode

    "-order=mode"
        run the tests in one of the modes: (repeat|random|SEED)

    "-ping[=block]"
        test if server is running or port in use

    "-post"
        POST url

    "-postamble"
        config to add at the end of "httpd.conf"

    "-preamble"
        config to add at the beginning of "httpd.conf"

    "-proxy"
        proxy requests (default proxy is localhost)

    "-run-tests"
        run the tests

    "-ssl"
        run tests through ssl

    "-start-httpd"
        start the test server

    "-stop-httpd"
        stop the test server

    "-trace=T"
        change tracing default to: warning, notice, info, debug, ...

    "-verbose[=1]"
        verbose output

    See for more information
    <https://perl.apache.org/docs/general/testing/testing.html>

  API CORE MODULES
    Apache2::RequestIO, Apache2::RequestRec

AUTHOR
    Jacques Deguest <jack@deguest.jp>

SEE ALSO
    Apache2::API::DateTime, Apache2::API::Query, Apache2::API::Request,
    Apache2::API::Request::Params, Apache2::API::Request::Upload,
    Apache2::API::Response, Apache2::API::Status

    Apache2::Request, Apache2::RequestRec, Apache2::RequestUtil

COPYRIGHT & LICENSE
    Copyright (c) 2023 DEGUEST Pte. Ltd.

    You can use, copy, modify and redistribute this package and associated
    files under the same terms as Perl itself.



( run in 0.699 second using v1.01-cache-2.11-cpan-524268b4103 )