NAME

DTA::CAB::Server::HTTP::Handler::CGI - DTA::CAB::Server::HTTP::Handler class: CGI form processing

SYNOPSIS

 ##========================================================================
 ## PRELIMINARIES
 
 use DTA::CAB::Server::HTTP::Handler::CGI;
 
 ##========================================================================
 ## Methods
 
 $h = $class_or_obj->new(%options);
 $bool = $h->prepare($server);
 undef = $h->finish($server, $clientSocket);
 
 \%params = $h->uriParams($hreq,%opts);
 \%params = $h->contentParams($hreq,%opts);
 \%params = $h->params($hreq,%opts);
 \%vars = $h->cgiParams($srv,$clientConn,$httpRequest, %opts);
 
 \%vars = $h->decodeVars(\%vars,%opts);
 \$string = $h->decodeString(\$string,%opts); ##-- decodes in-place;
 \$string = $h->decodeStringRef(\$string,%opts); ##-- decodes in-place;
 $enc = $h->messageEncoding($httpMessage,$defaultEncoding);
 $enc = $h->requestEncoding($httpRequest,\%vars);
 
 \%vars = $h->trimVars(\%vars,%opts);
 \%vars = $h->addVars(\%vars,\%push,$mode='push');
 

DESCRIPTION

Methods

new
 $h = $class_or_obj->new(%options);

%option, %$h:

 encoding => $defaultEncoding,  ##-- default encoding (UTF-8)
 allowGet => $bool,             ##-- allow GET requests? (default=1)
 allowPost => $bool,            ##-- allow POST requests? (default=1)
 pushMode => $mode,             ##-- push mode for addVars (dfefault='push')
prepare
 $bool = $h->prepare($server);

Just returns 1.

finish
 undef = $h->finish($server, $clientSocket);

Clean up handler state after run(). Override deletes @$h{qw(cgi vars cgisrc)}.

uriParams
 \%params = $h->uriParams($hreq,%opts)

Parses GET-style form parameters from $hreq->uri.

contentParams
 \%params = $h->contentParams($hreq,%opts);

Parses POST-style content parameters from $hreq. If $hreq content-type is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data', but content is present, returns $hreq content as the value of the pseudo-variable $opts{defaultName}. Known %opts:

 defaultName => $name,       ##-- default parameter name (default='POSTDATA')
 defaultCharset => $charset, ##-- default charset
params
 \%params = $h->params($hreq,%opts);

Wrapper for $h->pushVars($h->uriParams(),$h->contentParams()) %opts are passed to "uriParams"(), "contentParams"().

cgiParams
 \%vars = $h->cgiParams($srv,$clientConn,$httpRequest, %opts);
decodeVars
 \%vars = $h->decodeVars(\%vars,%opts);

Decodes cgi-style variables using $h->decodeString($str,%opts). Known %opts:

 vars    => \@vars,      ##-- list of vars to decode (default=keys(%vars))
 someKey => $someVal,    ##-- passed to $h-E<gt>decodeString()
decodeString
 \$string = $h->decodeString(\$string,%opts); ##-- decodes in-place;
 $decoded = $h->decodeString( $string,%opts); ##-- decode by copy

Wrapper for "decodeStringRef"().

decodeStringRef
 \$string = $h->decodeStringRef(\$string,%opts); ##-- decodes in-place;

Decodes string in-place as $h->{encoding}, optionally handling HTML-style escapes. Known %opts:

%opts: allowHtmlEscapes => $bool, ##-- whether to handle HTML escapes (default=false) encoding => $enc, ##-- source encoding (default=$h->{encoding}; see also $h->requestEncoding())

messageEncoding
 $enc = $h->messageEncoding($httpMessage,$defaultEncoding);

Atempts to guess messagencoding from (in order of descending priority):

requestEncoding
 $enc = $h->requestEncoding($httpRequest,\%vars);

Attempts to guess request encoding from (in order of descending priority):

trimVars
 \%vars = $h->trimVars(\%vars,%opts);

Trims leading and trailing whitespace from selected values in \%vars. Known %opts:

 vars    => \@vars,      ##-- list of vars to trim (default=keys(%vars))
addVars
 \%vars = $h->addVars(\%vars,\%push,$mode='push');

CGI-like variable push; destructively adds \%push onto \%vars.

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2010-2019 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.1 or, at your option, any later version of Perl 5 you may have available.

SEE ALSO

DTA::CAB::Server::HTTP::Handler(3pm), DTA::CAB::Server::HTTP(3pm), DTA::CAB(3pm), perl(1), ...