At 01:07 -0800 1/18/04, Stas Bekman wrote:
Elizabeth Mattijsen wrote:
>Coming back to the original issue. Is it really so bad to load everything "automatically" if >you're using a prefork MPM?
You can if you want to. That's definitely won't be the default. Don't forget that mp2 is much more than mp1. And people may want to use just one of its modules (e.g. a filter) w/o using modperl itself. Would you want to have 40+ modules preloaded for you when you need only 2?
Well, yes. But that is tuning. If you want people to easily migrate, I think making it the default would be best from a user friendliness point of view. Maybe add a warning to the error log if you're doing it the lazy way.
*** Note: currently all xxxx modules have been loaded. This may not be the most efficient
*** way of using Apache 2. Please check xxxx for more tuning information.
Ideally, have a message added to the error log at shutdown time with a list of modules that
were actually used during the run,
*** According to usage statistics, you should change the following lines in your config:
aaaa
bbbb
ccccc
although I wonder how one would do that.
Many people don't look in their error_log files.
Many people find it annoying when they error_log files contain messages they haven't asked for.
For an easy transition load Apache::compat. It already loads all the modules for APIs you've used in mp1.
If you want to preload all add ModPerl::MethodLookup::preload_all_modules to startup.pl. This can't be the default behavior.
Just brainstorming here: maybe the default should be to load just package specific AUTOLOAD subs for each package, whose only function would be to set a flag that the package was being used and then load the real package?
Something like (more or less pseudo code here)
startup:
foreach (qw(Foo Bar)) { # all of the appropriate Apache modules my $package = "Apache::$_"; *{$package.'::AUTOLOAD'} = sub { if ($INC{$package}) { # real error, sub not found after package loaded } else { (my $filename = $package) =~ s#::#/#s; require "$filename.pm"; goto &${$package.'::AUTOLOAD'}; } } }
shutdown:
my @module; foreach (qw(Foo Bar)) { my $package = "Apache::$_"; push @module,$INC{$package}; } if (@module) { warn "*** According to....\n"; warn " $_\n" foreach @module; }
It's totally up to you. Feel free to release a CPAN module which does any of these tricks and people can easier re-use it if they want to. This is really beyong the core support and will confuse people more than it'll help them.
I'm off to sleep ;)
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]