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

Before I go out and write my own replacement for it, is anyone aware of a non Apache::File based implementation of Apache::File::meets_conditions?

For those totally lost, this is necessary to handle conditional GET (where If-Matches: or If-Modified-Since: is set) sanely. If you're using mod_perl (as I normaly would be) it's no big deal to just use Apache::File::meets_conditions and use that to determine if the response should actually be sent or not, but there doesn't appear to be an equivalent for non-mod_perl perl CGIs.

Replies are listed 'Best First'.
Re: non mod_perl Apache::File
by Fletch (Bishop) on Dec 04, 2004 at 14:25 UTC

    Browsing through the source that looks to be a wrapper around the Apache C API ap_meets_conditions call, so it's not even perl code you could swipe. You might could see if you could wrap the apache code with Inline::C, but I'd bet it's too entangled with other parts of the Apache API to do so easily. Probably be easiest to see what the C's doing and use that to reimplement the functionality in perl.

      Probably be easiest to see what the C's doing and use that to reimplement the functionality in perl.
      Yeah, that's pretty much what I had planned on doing from the beginning if I couldn't find someone else's implementation of the same. [I'd just rather avoid re-inventing the wheel if the wheel exists and is wheel-like enough for my purposes.]