Ryan Thompson wrote: > There must be a faster way. I have thought about pre-compiling each > HTML file into a Perl module, but there would have to be an automated > (and secure) way to suck these in if the original file changes. > > Either that, or maybe someone has written a better parser. My code > looks something like this, to give you an idea of what I need: >
Sure there are tons of good template systems out there. I think someone made a comment about writing a template system being a right of passage as a perl developer. But it's also more fun to do it yourself. I guess you've tried compiling your regex with the o modifier? Also, have you tried caching your HTML in global package variables instead of shared memory? I think it may be a bit faster than shared memory segments like Apache::Cache uses. (The first request for each child will be slower, but after they've each served once, they'll all be fast). Does your engine stat (access) the html file on disk for each request? You mentioned you're caching, but perhaps you're checking for changes to the file. Try to stat as infrequently as possible, or if you have to then use the _ special filehandle for multiple stats. Just my 2c. ~mark.