|Think about Loose Coupling|
mod_perl and dtrace (or why certain unicode files don't load at startup time)by redhotpenguin (Deacon)
|on Dec 07, 2007 at 18:59 UTC||Need Help??|
redhotpenguin has asked for the
wisdom of the Perl Monks concerning the following question:
This is a cross post of an email sent to the mod_perl users list, there was a suggestion that I should post it here also because of utf experts hanging around here.
I've been having fun with dtrace, and I most recently used it to see what files are being accessed by mod_perl during requests. I've preloaded all the modules in my application that I know about into startup.pl, but when I startup my httpd server and make a request, I got some unexpected results.
Those files showed up during the first request, but not subsequent requests. A little digging showed that this was the URI::http module being loaded at runtime, since my application uses URI. But I use URI (); in my startup.pl - apparently URI::http isn't being loaded. Looks like URI requires http.pm at runtime:
Fine and good, I added URI::http to my startup.pl and those file stats went away. There were some other offenders too though:
Hmm, I use Encode in my application, and preload it but why aren't those files being loaded at startup?
I tried adding 'use utf8 ();' to startup.pl and it had no effect. So I added the following require directives to startup.pl
and everything but Fold.pl and SpacePer.pl was loaded at startup. The remaining dtrace lines:
I'm not sure why these programs are still loaded at runtime, but I've probably managed to save about 40k or so per process by preloading these modules I am guessing. Not much but every byte counts. If anyone has the unicode foo to tell me why those programs aren't loading, I'd be very interested in knowing.