If you use mod_perl 1, there is Apache :: FakeRequest , which comes with mod_perl. This is not a complete layout of the request object, so you need to add some of your methods. Even if your code uses Apache :: Request . Even more for cookies and downloads. Basically you are going to spend a lot of time with Test :: MockObject . Fortunately, Apache's interfaces are pretty simple.
If at all possible, you should consider switching to the Plack framework (Catalyst, Dancer , etc.), which provide much more reliable testing and debugging tools. If you use mod_perl2, you're in luck! It is easy (relative to mod_perl 1) to wrap a mod_perl2 application with Plack. Plack :: App :: FakeApache does most of the work for you. Here is a discussion outlining various methods and benefits.
Schwern
source share