in reply to CGI open of tmpfile will look among the following directories for one that is writeable to your CGI user (non-Unix directories left out):
Contents of environment variable TMPDIR /usr/tmp /var/tmp /tmp /temp current working directory
In your case, none of the above directories seem to be writable to your CGI user.

The easiest solution is probably to set $ENV{'TMPDIR'} in your code to point to a directory that is writable to your CGI user.