Elizabeth Mattijsen wrote:
At 16:19 -0800 1/17/04, Stas Bekman wrote:

And it's not on by default, because AUTOLOAD introduces all kind of problems. And as explained in:
http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html#C_AUTOLOAD_
and I weren't able to use it in any phase before PerlChildInitHandler, which means that it won't work for your startup.pl.


The problem comes from the fact that we need to use UNIVERSAL::AUTOLOAD. We can't use plain package AUTOLOAD, precisely because of the chicken and egg problem. We don't know which module to load, and if we load them all, we don't need AUTOLOAD. So I figured UNIVERSAL::AUTOLOAD is the only workable solution.

If you have better ideas solving this problem I'm all ears.



"Moreover installing UNIVERSAL::AUTOLOAD may cause a lot of problems, since once it's installed Perl will call it every time some method is missing (e.g. undefined DESTROY methods)."


Well, the DESTROY method issue could be fixed with adding a:

sub UNIVERSAL::DESTROY { undef }

method? (note I'm adding an undef here because 5.8.2 has an issue with empty subs).

Have you tried that during the server startup phases? I don't remember now but I was getting all sort of errors and segfaults when I was trying to use UNIVERSAL::AUTOLOAD at the server startup.


That's fine, but that's introducing bloat (which may not be such a problem with perfork MPM's, but _may_ be a problem with other MPM's, particularly based on Perl 5 ithreads).
Maybe it shouldn't be an AUTOLOAD, but a custom die() handler... ;-)

But someone needs to trigger that custom die() handler. Or are you talking about installing $SIG{__DIE__} instead of using AUTOLOAD for trapping? You are aware that doing that comes with its own pile of problems, in certain contexts (.e.g. eval {} blocks)


I was more thinking along the lines:

  BEGIN { *CORE::GLOBAL::die = sub {
     warn "We're not dieing with @_\n";
  } };
  die "This is it!";
  warn "Well, I guess it wasn't.\n";

Of course it needs to handle the case if someone has already redefined CORE::GLOBAL::die. But certainly this is another option, which I haven't tried. If you can test that it works and post a patch to the ModPerl::MethodLookup manpage, that would be great. It should be very similar to the AUTOLOAD example and perhaps we could provide an API to turn that handler on w/o doing copy-n-paste.


__________________________________________________________________
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]



Reply via email to