You might consider about taking a look at HTML::Mason,
from CPAN or http://www.masonhq.com,
which is a mod_perl related dynamic content module.
It might seem a bit awkward at the beginning but the speed
increase is nice, it has it's own caching magic of
components.