Probably not from the Perl side. Often, the web server reads the entire
post before it hands it off to the CGI, and then gives the CGI a handle
onto the buffered data, rather a handle to read the data directly from
the network connection. So you very well may need to look for something
specific either to the server itself, or to the mod_perl aspect of the
server.
Actually, I don't think this is possible at all using a single http
connection. It seems the browser refuses to read any of the response until
the server first reads the post in its entirety. (This is why CGI reads
the entire post, just dumping it into /dev/null, when POST_MAX is
exceeded). The server could drop the connection as soon as it realizes the
post is going to be too large, but then the browser will just report a
generic connection problem, rather than any specific error message you
might want it to.
Xho