The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Description

HttpArgParser is a package designed for use in Mod Perl handlers and CGI scripts

It provides an object, which, when instantiated, slurps up all the arguments passed via the CGI or mod perl ENV, including STDIN and MIME MULTIPART form data

Only one object should be created per HTTP POST or GET-- if you create a second one, it won't get POST parameters

Usage:

        my $http_obj = HTML::Tmojo::HttpArgParser->new();
        my %args = $http_obj->args();

        or

        my $http_obj = HTML::Tmojo::HttpArgParser->new();
        my %args = $http_obj->args(
                foo => 'array',
                bar => 'hash',
                goo => 'ref',
        );

If you want some arguments to be interpreted as hashes or arrays, you can specify that by passing a literal hash of argument names and types.

new:method

my $http_obj = HTML::Tmojo::HttpArgParser->new()

Parses all standard parameters in the HTTP query string and the http POST (if there is one) and stores them in a new object, then returns the new object.

args:method

Call this to retrieve the GET and POST arguments stored in the object.

        my %args = $HttpArgParser->args();

        or

        my %args = $http_obj->args(
                foo => 'array',
                bar => 'hash',
                goo => 'ref',
        );

args_query:method

Call this to retrieve ONLY the QUERY arguments stored in the object (this ignores the POST arguments)

        my %query_args = $HttpArgParser->args_query();

        or

        my %query_args = $HttpArgParser->args_query(
                foo => 'array',
                bar => 'hash',
                goo => 'ref',
        );

args_post:method

Call this to retrieve ONLY the QUERY arguments stored in the object (this ignores the POST arguments)

        my %query_args = $http_obj->query_args();

        or

        my %query_args = $http_obj->query_args(
                foo => 'array',
                bar => 'hash',
                goo => 'ref',
        );

arg_count:method

You can call this method with an argument name to find out how many total arguments of that name were submitted:

        my $count = $http_obj->arg_count('password');

arg_headers:method

When a mime-multipart post was submitted, you can call this method with an argument name to get back all the headers that came with for that argument parsed as a literal hash. Like this:

        my %file_headers = $http_obj->arg_headers('file');

read_get:method

Called internally, reads the arguments from the query string and adds them to $self->{args}{...}

read_post:method

Called internally, reads the arguments from STDIN and adds them to $self->{args}{...}

read_mime_post:method

Called internally, reads the arguments from STDIN, translates them from mime/multipart and adds them to $self->{args}{...}

url_decode

decodes a urlencoded string, replacing '+' with ' ' and %XX with the provided hex value we don;t bother to export this stupid function, BTW