Glancing through the XS source, it returns HTTP_REQUEST_ENTITY_TOO_LARGE which has a value of 413 (and thus is true for perl). What you want to do is make sure it's returning OK instead.
<%perl>
my $apr = Apache::Request->instance( $r, POST_MAX => 1 );
my $status = $apr->parse();
if( $status != Apache::Constants::OK ) {
print "Too big";
} else {
print "Just right.";
}
</%perl>
Update: As a somewhat related aside, if you're using HTML::Mason::ApacheHandler the $r global should already be upgraded to an Apache::Request instance for you by default (or you can explicitly request this by passing args_method => "mod_perl", but that's the default setting; the other option is to set it to CGI to get a CGI.pm instance).
Another Update: Looking into what HTML::Mason::ApacheHandler does, it appears it already calls Apache::Request->instance() with no extra arguments. This might explain your problem (i.e. the instance is created and possibly already parsed before your size limitation is seen). If that's the case you might need to subclass HTML::Mason::ApacheHandler to override the prepare_request() method yourself.
package My::ApacheHandler;
use base 'HTML::Mason::ApacheHandler';
sub prepare_request {
my $self = shift;
my $r = shift;
Apache::Request->instance( $r, POST_MAX => 1 );
return $self->SUPER::prepare_request( $r, @_ );
}
1;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|