Subroutine Name


Explanation and Usage

GetParam retrieves a parameter from the script. This could be either a CGI environment variable, a script variable, a field from a submitted form, etc.

Note that as of Version 0.50, GetParam will call QuoteHTML on the parameter before returning it. So if you are expecting regular HTML in your data, you will have to call [UnquoteHTML?] on it.


GetParam(Name, Default);


Name - This is the name of the parameter you want to get. This will retrieve any of the CGI environment variables, as well as any script actions. The do action tells you what the script is trying to do (posting, revision, history, etc). page will return the name of the current page.

Default - This is the value to return if the parameter is not set. This is entirely optional, however by default GetParam will return 0 if the parameter is not set. If you need anything else, be sure to call GetParam with a default value defined.


These are actual examples from the Aneuch source code:

my $action = GetParam('doing');
Here, the variable $action is set to the value of the doing parameter. If doing is not set, then $action will be 0 (since no default is defined).

← Return to API listing