$ perldoc CGI | tail -n +767 | head -n 13
The temporary directory is selected using the following algorithm:
1. if the current user (e.g. "nobody") has a directory named
"tmp" in its home directory, use that (Unix systems only).
2. if the environment variable TMPDIR exists, use the location
indicated.
3. Otherwise try the locations /usr/tmp, /var/tmp, C:\temp,
/tmp, /temp, ::Temporary Items, and \WWW_ROOT.
Each of these locations is checked that it is a directory and is
writable. If not, the algorithm tries the next choice.
$
so it should be as easy as making a directory that's writable by the script and then setting the TMPDIR environment variable.