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

In reply to POST_MAX with CGI.pm/Form Validation by perleager

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.