|
nwetters writes "I've put together a module that emulates the Apache request object from CGI. Think of it as the nemesis to Apache::Registry.
The reason behind the code was simple. I had a look at Ave Wrigley's WWW::AdManager in the hope of adding the features I needed. I was impressed that he'd got the code to work both as an Apache module and through CGI. He'd managed to do this by having separate entry points for Apache and CGI, and a few 'if ($ENV{MOD_PERL}){...}'. It looked like the code was going to become unmaintainable.
So, I stripped the CGI-dependent code from WWW::AdManager, and concentrated on getting the mod_perl-only module working through CGI. The result was Apache::Emulator. I've been lazy and only implemented the easy bits and the bits necessary to get Ave's AdManager working (i.e. there's a few essentials such as header_in, headers_in and headers_out that still don't exist).
Initial benchmarks with WWW::AdManager suggest that stripping out
CGI-dependent conditionals speeded up the module by 30%, both as an Apache module and as a CGI (through Apache::Emulator).
Please let me know your thoughts, and any potential applications that you can foresee. I'd also like to know of any other modules that I can use as test cases for adding functionality to Apache::EMulator. Plus, of course, I'd love it if everyone emailed me the remaining unimplemented methods ;)
Apache::Emulator will be available from CPAN after the next sync."
|