This not hard at all. In fact, you may want to take a look at Apache::Session, which may do what you want already. If it does not, looking at the source code will give you an idea of how to get this done. There is also the book 'Writing Apache Modules in Perl and C' by ORA, as well as tutorials somewhere off of perl.apache.org.