BEGIN # run before anything { my $POST_MAX = -1; my $CL = defined($ENV{'CONTENT_LENGTH'}) ? $ENV{'CONTENT_LENGTH'} : 0; if(($POST_MAX > 0) and ($CL > $POST_MAX)) { print "Content-Type: text/plain\n", "Status: 413\n\n", "413 Request entity too large"; exit; } } #### METHOD: { # avoid unreasonably large postings if (($POST_MAX > 0) && ($content_length > $POST_MAX)) { #discard the post, unread $self->cgi_error("413 Request entity too large"); last METHOD; }