perleager has asked for the wisdom of the Perl Monks concerning the following question:

Hey,

I'm trying to retrieve a error CGI.pm produces from the POST_MAX function. I'm using a form validating / template system and somehow the paremeters are being passed through the same hash key/object(in this case, $self)? If someone uploaded a file to big, i want it to display the proper message, but somehow I can't retrieve the paremeter. (its in the HTTP status when a file posted is to large). Am I forgetting to create a new CGI object and therefore I can't retrieve the error message?
sub form_display { my $self = shift; my $errs = shift; my $t = $self->load_tmpl('business_plan.tmpl',die_on_bad_params=>0 +); if (ref $errs) { $t->param($errs) } else { my $error = $self->cgi_error; if ($error) { $t->param( error_message => "the file was to big"); } else { $t->param( error_message => ""); } } return $t->output; }


Basically this code first checks if there are any errors in the paremeters produced from the form. If no errors, it'll pass a new paremeter string, $t->param( error_message => "the file was to big"). The thing is everytime it loads up the default form page, no paremeters are being passed, so therefore it'll still say the error_message. How can I read the HTTP Status paremeter ? once the file posted is to large and then I can use another if statement to determing the correct error message.

Anthony