CGI Class
The Maxscape::CGI class is used to access the 'QUERY_STRING' CGI environment variables. 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
Member Functions
- addParameter
- deleteParameter
- deleteQuery
- Error
- escapeURL
- getAndDeleteFirstParameter
- HTTP_Host
- HTTPS
- InitQueryParameter
- new
- ParamIsSet
- Query
- QueryParameter
- QueryParameterArray
- queryParamList
- RequestMethod
- RequestURI
- RequestURIScript
- ScriptURI
- setQuery
- unescapeURL
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.
If you like the CGI.pm module from Lincoln D. Stein to handle forms, you may include it via the application plugin (use CGI.pm). This should not interfere with the Maxscape::CGI.pm module and may freely be intermixed.
Examples
my $CGI = $self->{Context}->{CGI}; my $myCGIParameter = $CGI->Query ('myCGIParameter'); if ($Page->{Context}->{CGI}->Query ('myCGIParameter')) { .. # add your stuff }
new
Synopsis
use Maxscape::CGI;
Description
Returns the name of the page to be displayed. Within appliction functions normaly usage of the new function is not nessecary, case it is called by the servers runtime system.
Examples
In a page context it may be referenced via the page context member object: my $CGI = $self->{Context}->CGI;
InitQueryParameter
Synopsis
Description
Reads data from the CGI interface.
Examples
Error
Synopsis
Description
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
addParameter
Synopsis
my $Parameter = $CGI->addParameter();
Description
deleteQuery
Synopsis
my $Parameter = $CGI->deleteQuery();
Description
deleteParameter
Synopsis
$CGI->deleteParameter();
Description
getAndDeleteFirstParameter
Synopsis
my $Parameter = $CGI->getAndDeleteFirstParameter();
Description
QueryParameterArray
Synopsis
my $Parameter = $CGI->QueryParameterArray();
Description
queryParamList
Synopsis
my $Parameter = $CGI->queryParamList();
Description
ParamIsSet
Synopsis
my $Parameter = $CGI->ParamIsSet();
Description
escapeURL
Synopsis
my $Parameter = $CGI->escapeURL();
Description
unescapeURL
Synopsis
my $Parameter = $CGI->unescapeURL();
Description
RequestMethod
Synopsis
my $Parameter = $CGI->RequestMethod();
Description
RequestURI
Synopsis
my $Parameter = $CGI->RequestURI();
Description
RequestURIScript
Synopsis
my $Parameter = $CGI->RequestURIScript();
Description
HTTPS
Synopsis
my $Parameter = $CGI->HTTPS();
Description
ScriptURI
Synopsis
my $Parameter = $CGI->ScriptURI();
Description
HTTP_Host
Synopsis
my $Parameter = $CGI->HTTP_Host();
Description