CGI Maxscape::Class
The Maxscape::CGI class is used to access the 'QUERY_STRING' CGI environment variable. For example, the '$CGI->Query('myKey')' member function returns the CGI value(s) of the given key. If invoked in a list context, the function returns the entire list. Otherwise it returns the first element of the list.
<html>
...
@{[$Page->{CGI}->Query('Key')]}
...
</html>
To see how it works, add the string '&Key=Hallo&Key=World!' add the end of the URL in the 'Location' field of your browser and look what you have entered:
Maxscape::CGI Package
Synopsis
use Maxscape::CGI;
Description
The Maxscape Maxscape::CGI package supplies the basic functionality to deal with the CGI environment provided by the CGI 'QUERY_STRING' and other variables.
Examples
my $CGI = $Page->{Context}->{CGI};
my $myCGIParameter = $CGI->Query ('myCGIParameter');
if ($CGI->Query ('myCGIParameter')) {
.. # add your stuff
}
... @{[ $Page->Context->CGI->Query ('foo') ]} ...
List of Member Functions
- addParameter
- deleteParameter
- deleteQuery
- Error
- escapeURL
- getAndDeleteFirstParameter
- HTTP_Host
- HTTPS
- InitQueryParameter
- new
- ParamIsSet
- Query
- QueryParameter
- QueryParameterArray
- queryParamList
- RequestMethod
- RequestScheme
- RequestURI
- RequestURIScript
- ScriptURI
- setQuery
- unescapeURL
Member Functions
new
Synopsis
use Maxscape::CGI;
Description
Creates a CGI object. Within appliction functions normaly usage of the new function is not nessecary, because it is created by the server's runtime system.
Examples
use Maxscape::CGI; my $CGI = Maxscape::CGI->new ($Request, $ClientConnection);
InitQueryParameter
Synopsis
$self->InitQueryParameter($Request, $ClientConnection);
Description
Reads the data from the CGI interface.
Error
Synopsis
$CGI->Error;
Description
Returns an error text.
Query
Synopsis
my $Parameter = $CGI->Query('myParameter');
Description
Returns the value of the taken member function parameter. If the parameter is not found, returns 'undef'.
The Query('myParameter') member function returns the value(s) of the given key. If invoked in a list context, the function returns the entire list. Otherwise it returns the first element of the list.
Examples
my $foo = '';
my @bar = $Page->CGI->Query('FormSelectGroup');
foreach (@bar) {
if ($_ =~ /^foobar=/) {
$_ =~ s/^foobar=//;
$foo = $_;
last;
}
}
&::perr("PageNumber=$PageNumber;");
QueryParameter
Synopsis
my $Parameter = $CGI->QueryParameter('myParameter');
Description
Returns the value of the taken member function parameter. If the parameter is not found, returns 'undef'.
setQuery
Synopsis
my $Parameter = $CGI->setQuery();
Description
Copies the functions parameters into an internal form.
addParameter
Synopsis
my $Parameter = $CGI->addParameter();
Description
Adds a parameter.
deleteQuery
Synopsis
my $Parameter = $CGI->deleteQuery('Param');
Description
Deletes a parameter.
deleteParameter
Synopsis
$CGI->deleteParameter();
Description
Deletes a parameter.
getAndDeleteFirstParameter
Synopsis
my $Parameter = $CGI->getAndDeleteFirstParameter();
Description
Gets and deletes a parameter.
QueryParameterArray
Synopsis
my $Parameter = $CGI->QueryParameterArray();
Description
Splits parameters into an array.
queryParamList
Synopsis
my $Parameter = $CGI->queryParamList();
Description
Splits parameters into an array.
ParamIsSet
Synopsis
my $Parameter = $CGI->ParamIsSet();
Description
Checks if a parameter is set.
escapeURL
Synopsis
my $Parameter = $CGI->escapeURL();
Description
Escapes URL.
unescapeURL
Synopsis
my $Parameter = $CGI->unescapeURL();
Description
Unescapes URL.
RequestMethod
Synopsis
my $Parameter = $CGI->RequestMethod();
Description
Returns the request method.
RequestURI
Synopsis
my $Parameter = $CGI->RequestURI();
Description
Returns the request URI.
RequestURIScript
Synopsis
my $Parameter = $CGI->RequestURIScript();
Description
Returns the request URI script.
HTTPS
Synopsis
my $Parameter = $CGI->HTTPS();
Description
Tells if the request is encrypted.
RequestScheme
Synopsis
my $ReqestSheme = $CGI->RequestScheme();
Description
Returns the scheme of the request URL.
ScriptURI
Synopsis
my $Parameter = $CGI->ScriptURI();
Description
Returns the script URI.
HTTP_Host
Synopsis
my $Parameter = $CGI->HTTP_Host();
Description
Returns the HTTP host.
Maxscape::CGI::Multipart Package
Synopsis
use Maxscape::CGI::Multipart;
Description
The Maxscape::CGI::Multipart is used to read multipart/form-data requests.
List of Member Functions
Member Functions
new
Synopsis
use Maxscape::CGI::Multipart;
Description
Creates a new Maxscape::CGI::Multipart object.
Examples
my $Buffer = new Maxscape::CGI::Multipart ($Boundary, $Length, $ClientConnection);
readHeader
Synopsis
my %Header = $Buffer->readHeader;
Description
Reads and returns the headers as a hash. $CRLF$CRLF is end of the header section.
Examples
my %Header = $Buffer->readHeader;
readFormField
Synopsis
my $Body = $Buffer->readFormField;
Description
Reads and returns a non-file form field, as a single scalar value.
Examples
my $Body = $Buffer->readFormField;
read
Synopsis
my $Data = $Buffer->read;
Description
This will read $Bytes or until the boundary is hit, whichever happens first. After the boundary is hit, undes is returned. The next read will skip over the boundary and begin reading again;
Examples
my $Data = $Buffer->readFormField;
fillBuffer
Synopsis
my $Data = $Buffer->fillBuffer ($Bytes);
Description
This fills up the buffer so that the boundary is never split between reads.
Examples
my $Data = $Buffer->fillBuffer ($Bytes);
eof
Synopsis
my $EOF = $Buffer->eof;
Description
Tells if the EOF is reached.
Examples
my $EOF = $Buffer->eof;1
| Next ∙ Previous ∙ Top ∙ Join ∙ Contact | © Maxscape |
