Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Apache::RequestNotes in mod_perl 2.0

by ait (Friar)
on Aug 29, 2014 at 14:54 UTC ( #1099002=perlquestion: print w/ replies, xml ) Need Help??
ait has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I noticed that Apache::RequestNotes doesn't seem to be available for Apache2 so I am guessing that this functionality was incorporated in mod_perl 2.0 natively?

If so, would someone kindly point me to an example on how to do this exact same thing with mod_perl 2?

I need something very early in the request that parses form data and then make it avail to the rest of the request. My current solution involves a PerlTransHandler that slurps the content, parses it and saves it to notes. Then I have to re-inject the raw content back with a PerlInputFilterHandler so it's avail for the rest of the request chain.

I hate re-inventing the wheel and I think something like Apache::RequestNotes would really be more elegant for what I'm trying to do.

Many thanks in advance!

Comment on Apache::RequestNotes in mod_perl 2.0
Re: Apache::RequestNotes in mod_perl 2.0
by Anonymous Monk on Aug 29, 2014 at 23:11 UTC

    I noticed that Apache::RequestNotes doesn't seem to be available for Apache2 so I am guessing that this functionality was incorporated in mod_perl 2.0 natively?

    No, it was never part of mod_perl, the mod_perl folks don't maintain that module

    If so, would someone kindly point me to an example on how to do this exact same thing with mod_perl 2?

    Um, port the module? Apache2::compat, Apache2::porting ...

      Thanks but the question was more like: is there a native way in mod_perl 2.0 way to process form parameters very early in the request?

      Anyway, this paragraph on Apache::RequestNotes FEATURES/BUGS: "Since POST data cannot be read more than once per request, it is improper to both use this module and try to gather...", told me that our current solution is doing the right thing by slurping/processing content early on and the re-injecting in an input filter later to make content avail for later handlers and other modules (e.g. mod_proxy, etc.). It would be cool though if there was some native form-parameter handlers like Apache::RequestNotes avail for mod_perl 2.x. and that would conserve content for the rest of the cycle and other handlers. This would be very useful to translate broken content-driven APIs to more URL-driven APIs.

      The reason we need to do this is because nowadays there are many API's that are called "RESTful" but that do not not use resource-based URLs so many times you need to inspect content early on to trap/route a request accordingly. Man, if people would actually understand HTTP to begin with, we would have to be constantly hacking away to make stupid code work right.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1099002]
Front-paged by GotToBTru
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2014-12-22 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (116 votes), past polls