Geoffrey Young wrote:


Stas Bekman wrote:

I'm splitting my hair for a few days trying to figure out how to figure out whether it was ExtUtils::MakeMaker who has overriden some MY::foo method or Makefile.PL.


[lots of hard work snipped]

as an aside, if this is proving so difficult, does anybody think it's worth investigating Module::Build as the primary build mechanism? granted, it means _lots_ of changes, but if we have to move to something like B::Deparse to support third party modules maybe it's worth it. I haven't used the interface myself, but maybe it's worth a look.

I've found a much simpler solution which should work as long as EU::MM doesn't change the logic of mv_all_methods. I simply override the function and undef the eval "" stabs that EU::MM::mv_all_methods has installed for methods that ModPerl::MM may need to override.


sub override_eu_mm_mv_all_methods {
    my @methods = @_;

    my $orig_sub = \&ExtUtils::MakeMaker::mv_all_methods;
    no warnings 'redefine';
    *ExtUtils::MakeMaker::mv_all_methods = sub {
        # do the normal move
        $orig_sub->(@_);
        # for all the overloaded methods mv_all_method installs a stab
        # eval "package MY; sub $method { shift->SUPER::$method([EMAIL PROTECTED]); }";
        # therefore we undefine our methods so on the recursive invocation of
        # Makefile.PL they will be undef, unless defined in Makefile.PL
        # and my_import will override these methods properly
        for my $sym (@methods) {
            my $name = "MY::$sym";
            undef &$name if defined &$name;
        }
    };
}

Notice that all this trickery is just for developer's convenience, so they don't have to muck around their Makefile.PL.

But the B::Deparse solution was quite fun ;)

__________________________________________________________________
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