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.
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.
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', );
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', );
my %query_args = $http_obj->query_args(); or my %query_args = $http_obj->query_args( foo => 'array', bar => 'hash', goo => 'ref', );
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');
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');
Called internally, reads the arguments from the query string and adds them to $self->{args}{...}
Called internally, reads the arguments from STDIN and adds them to $self->{args}{...}
Called internally, reads the arguments from STDIN, translates them from mime/multipart and adds them to $self->{args}{...}
decodes a urlencoded string, replacing '+' with ' ' and %XX with the provided hex value we don;t bother to export this stupid function, BTW
To install HTML::Tmojo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Tmojo
CPAN shell
perl -MCPAN -e shell install HTML::Tmojo
For more information on module installation, please visit the detailed CPAN module installation guide.