Hi Stas,

I tried it and unfortunely it did not work for me. I downloaded the CVS 
version of modperl-2 and installed your patch. 
As next step I removed all MP2 use directives.

#use Apache::RequestRec ();
#use Apache::RequestIO ();
#use Apache::ServerUtil ();
#use Apache::RequestUtil ();
#use Apache::Util ();
#use APR::Date ();

This is the result.

waiting 60 seconds for server to start: ..[Tue Feb 10 17:57:49 2004] [warn] 
Syntax error 
at /home/ptest2/src/Apache-PageKit-2.12-5/t/conf/extra.last.conf:15 Can't 
locate object method "server" via package "Apache" 
at /home/ptest2/src/Apache-PageKit-2.12-5/blib/lib/Apache/PageKit.pm line 
113.

Now I uncomment 

use Apache::ServerUtil ();

to get access to the server method.

Now my error message is 

Can't locate auto/Apache/Request/PageKit/headers_in.al

So I think Apache::Request use a kind of ->can to check for a method before it 
forwards it. This makes the EazyLife option useless for me. ( Or I have to 
support a kind of autoloader or preloader for my class, but that make it 
useless too. )

Am Montag, 9. Februar 2004 19:38 schrieb Stas Bekman:
> Stas Bekman wrote:
> > Perrin Harkins wrote:
> >> On Tue, 2004-01-20 at 16:17, Stas Bekman wrote:
> >>> I now more or less have an idea on how to solve the code usage problem.
> >>
> >> Great!
> >
> > My idea is replace UNIVERSAL::AUTOLOAD with AUTOLOAD for each class that
> > contains objects, so when the method is called on that object it'll do
> > just that:
> > http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html#C_AUTOLOAD_
>
> [...]
>
> OK, here it is. Please give it a try:
>
> Index: lib/ModPerl/WrapXS.pm
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/lib/ModPerl/WrapXS.pm,v
> retrieving revision 1.64
> diff -u -u -r1.64 WrapXS.pm
> --- lib/ModPerl/WrapXS.pm     31 Jan 2004 10:06:59 -0000      1.64
> +++ lib/ModPerl/WrapXS.pm     9 Feb 2004 18:36:02 -0000
> @@ -786,6 +786,16 @@
>       return keys %$methods;
>   }
>
> +sub avail_modules {
> +    my %modules = ();
> +    for my $method (keys %$methods) {
> +        for my $item ( @{ $methods->{$method} }) {
> +            $modules{$item->[MODULE]}++;
> +        }
> +    }
> +    return keys %modules;
> +}
> +
>   sub preload_all_modules {
>       _get_modules() unless $modules;
>       eval "require $_" for keys %$modules;
> Index: src/modules/perl/mod_perl.c
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
> retrieving revision 1.206
> diff -u -u -r1.206 mod_perl.c
> --- src/modules/perl/mod_perl.c       10 Jan 2004 05:01:04 -0000      1.206
> +++ src/modules/perl/mod_perl.c       9 Feb 2004 18:36:02 -0000
> @@ -246,6 +246,10 @@
>       av_push(GvAV(PL_incgv),
>               newSVpv(ap_server_root_relative(p, "lib/perl"), 0));
>   #endif /* MP_COMPAT_1X */
> +
> +    /* AUTOLOADs */
> +    /* XXX: consider adding a config flag not to preload this module */
> +    modperl_require_module(aTHX_ "ModPerl::EazyLife", TRUE);
>
>       if (!modperl_config_apply_PerlRequire(s, scfg, perl, p)) {
>           exit(1);
> --- /dev/null 1969-12-31 16:00:00.000000000 -0800
> +++ lib/ModPerl/EazyLife.pm   2004-02-03 08:00:34.000000000 -0800
> @@ -0,0 +1,19 @@
> +package EazyLife;
> +
> +use ModPerl::MethodLookup ();
> +
> +for my $module (ModPerl::MethodLookup::avail_modules()) {
> +    *{"$module\::AUTOLOAD"} = sub {
> +        my($hint, @modules) =
> +            ModPerl::MethodLookup::lookup_method($AUTOLOAD, @_);
> +        if (@modules) {
> +            eval "require $_" for @modules;
> +            goto &$AUTOLOAD;
> +        }
> +        else {
> +            die $hint;
> +        }
> +    };
> +}
> +
> +1;
>
>
> ______________________________________________________________
> 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

-- 
Boris

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to