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

This is more of a pet peeve than a question since I presume there are no alternatives to the situation.

If you want to access POST'd data via mod_perl, you need to use APR::Table, since that is the object Apache2::RequestRec::headers_in returns. This is required to get the "Content-Length" field, needed by Apache2::RequestIO to read() the data.

But APR::Table adds 45mb to virtual memory size -- 10 times the memory required by Apache2::Const, RequestRec, RequestUtil, and RequestIO combined. Apache just receives this stuff as a string, obviously, and I've been looking thru the Apache C includes: it does not seem to me that getting the POST data afterward would require so much complication. And a CGI process will receive POST data directly on STDIN.

Am I the only one that sees a serious design flaw here? I'd rather use POST for tidyness, but it is not worth the ridiculous APR::Table overhead...I guess I could just provide read() with a massive number, but that seems a very poor practice.

  • Comment on mod_perl and APR::Table: why the madness?

Replies are listed 'Best First'.
Re: mod_perl and APR::Table: why the madness?
by Corion (Patriarch) on Oct 20, 2010 at 16:00 UTC

    CGI.pm works under mod_perl too, and it doesn't seem to require APR::Table.

      Gosh, why didn't I think of that* -- guess it was worth inquiring, thanks.

      *answer: because I didn't realize CGI.pm was applicable, but lo, it works!