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;