If the @map passed parameter contains a NUL (\0) in the first array position, the map is assumed to be null-separated and @map is built by splitting it. This allows a null-separated todo.map with multiple values (parsed by a cgi-lib.pl or the like) to be referenced.

All of the following examples assume the above definitions in your form.

We are assuming the map definition above, with the type=image variable named todo, and the map in todo.map. You can pass the map in one of two ways. The first is compatible with the CGI.pm (or CGI::*) modules, and passes the map as an array:

If you are running with taint checking, as is suggested for CGI programs, you can use map_untaint(1) to set map untainting on a global basis. (If using class methods, each has its own instance of untainting).

It ensures all characters in the action fit pattern of [-\w.+@]+, meaning alphnumerics, underscores, dashes (-), periods, and the @ sign. It also checks the methods (rect,poly,point,default,circle) and ensures that points/tuples are only integers. Once that is done, it untaints the passed form variables.

The class methods for CGI::Imagemap are much the same as above, with the exception that multiple imagemaps are then maintained by the module, with full independence. The following method definitions assume the CGI::Form module is being used, like this:

use CGI::Form;
use CGI::Imagemap;
$query = new CGI::Form;
$map = new CGI::Imagemap;