Apache::SSLLookup

geoff on 2004-11-04T14:36:36

I released Apache-SSLLookup to CPAN yesterday, which was created to address the issues mentioned in this mod_perl discussion thread.



while the module is only really useful for interacting with mod_ssl, the code itself is actually a nice, simple example of a few new mod_perl 2.0 concepts.



it is written entirely in XS (except for the Dynaloader bootstrapping, of course). that it uses XS at all means that the Makefile.PL is a good example of how mod_perl 2.0 makes it very easy to generate a Makefile that can find what it needs on all platforms. in mod_perl 1.0 you needed a Makefile.PL like this to work on Win32. there's also a cool little Apache-Test feature in use there, which shows up only if a test fails.



speaking of tests, if you want to use Apache-Test to test SSL things then you will need to generate server-side certificates for mod_ssl to use. I haven't generated certificates in ages, but fortunately I didn't need to figure it out again - simply creating the directory t/conf/ssl is enough to have Apache-Test automagically generate a handful of certificates for you. see the ssl.conf.in for an example of putting these to use so you can issue https requests in your tests.



I also had a bit of fun in that the class is a proper subclass of Apache::RequestRec, but the constructor is written entirely in XS as well. so, the module shows you what you need to do to emulate

our @ISA = qw(Apache::RequestRec);

sub new { my ($class, $r) = @_;

return bless { _r => $r }, $class; }


in XS.



lastly, it illustrates how to interact with Apache's new optional function hooks, which is a pretty cool thing if you happen to need to do that.



anyway, enjoy.