use Perl
search use Perl
 
All the Perl that's Practical to Extract and Report
 
 

Apache::Emulator Released
posted by ziggy on 2001.10.29 8:05   
Module News
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."

 

 
use Perl Login
Nickname:

Password:

[ Create a new account ]

Related Links
  • nwetters
  • More on Module News
  • Also by ziggy
  • Apache::Emulator Released | Log in/Create an Account | Top | 7 comments | Search Discussion
    Threshold:
    The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
    Testing (Score:1)
    by Matts (1087) on 2001.10.29 9:10 (#1710)
    ( Last Journal: 2003.12.07 13:47 )
    Current testing options for mod_perl stuff under Apache/mod_perl 1.x are pretty weak. There's some work going on in the area, but most effort is being (rightly) put into mod_perl 2.x.

    So anyway, it'd be useful for offline testing to have an emulated Apache API. I'd especially like to be able to run AxKit tests without firing up an Apache instance.
    [ Reply to This ]
  • Re:Testing by nwetters (Score:1) 2001.10.29 9:18
  • Re:Testing by Matts (Score:1) 2001.10.29 11:24
  • Re:Testing by $Bob (Score:1) 2001.10.29 16:23
  • CPAN Update (Score:1)
    by nwetters (2347) <reversethis-{gro.napc} {ta} {srettewn}> on 2001.10.29 10:05 (#1716)
    ( http://patternsinperl.com/ )
    The module is now available here [cpan.org].
    [ Reply to This ]
    Why not FastCGI? (Score:1)
    by scotthom (2351) on 2001.10.29 13:55 (#1724)
    I can't figure out why nobody uses FastCGI as an alternative to Apache::Registry. I, too, prefer not to use mod_perl, but I don't want to reinvent the wheel... CGI::Fast, FCGI, and Apache's mod_fastcgi are all you need.
    [ Reply to This ]
  • Re:Why not FastCGI? by nwetters (Score:1) 2001.10.30 7:31
  • There are features that should not be used.
    There are concepts that should not be exploited.
    There are problems that should not be solved.
    There are programs that should not be written.
                --Richard Harter, <rh@smds.com>
    Download Perl Now!

    Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2004, their respective owners.