Have you looked to using the web server to provide your solution? At least Apache already knows about several different cases including "moved", "missing", "internal server error" and "service unavailable. Web pages for any of these cases can be customized, and can even include dynamic information.
I know Apache will allow you to provide custom error pages with some granularity, so one area of the website could have different error pages, if that's what you needed.
This just seems simpler and more straightforward to me than using Perl to reproduce what is already an easy to configure feature.