> A list of things I've noticed: > > * If you have two *different* modules which have the same name, then > either one, or the other is loaded in memory, never both. This is > dead annoying. I think Perl standard modules + CPAN modules should be > shared, other modules which are specific to a given script should not.
This is how perl works. You are not allowed to have two different modules with the same name loaded in the same interpreter. If you can't deal with that, maybe you should consider using an environment like Mason or Embperl which allow a page-based approach closer to PHP, rather than using perl's package namespace. It is also true that mod_perl 2 will have additional support for doing fancy things with virtual hosts, like having separate pools of interpreters (and thus separate namespaces) for each virtual host. See http://perl.apache.org/~dougm/modperl_2.0.html for more. >I am not the only developer on the planet. For >instance there is a CPAN module called HTML::Tree. But there is also >another module on the web called HTML_Tree, which installs itself as >HTML::Tree. One person's mistake hardly justifies a massive change in the way namespaces work in perl. Anyway, that was fixed, thanks to Terrence Brannon. His HTML::Seamstress module replaces the former HTML_Tree. > * Global variables should be reinitialized on each request. Or at least > if we want them to be persistent we do not want them to be shared with > different scripts on different virtual hosts! Global variables are variables without scope. They are not cleaned up by definition. If you want variables that go out of scope, use lexicals. If you have legacy code that depends on mod_cgi behavior to work, use Apache::PerlRun which clears globals on each request. > * Perl garbage collector should be smarter (okay, that may not be a > mod_perl issue). C geeks out there, ain't it possible to compile a > version of Perl with a better GC? Doug has talked about doing something with this in mod_perl 2 to help clean up memory taken for lexicals, but it's not definite. And yes, this is really a Perl issue, not a mod_perl one. - Perrin