You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2003/02/01 16:26:53 UTC

[patch] "subclassing" ModPerl::MM and glueing pods

I wanted to add the code to glue the pods from docs/api to the respective .pm 
files, so one can do perldoc on them. I spent a helluva lot of time trying to 
figure out how to add the make rules :( Moreover pm_to_blib is not 
overridable. Ok, so I add a new target using MY::postamble(), but I want it to 
exist for all Makefile.PL (so it has to live in ModPerl::MM), but that won't 
work, because some of Makefile.PL override that method already :( And 
ModPerl::MM can't be subclassed. Argh!

So here is a patch that first attempts to provide some sort of 
sub-class-ability for ModPerl::MM. Makefile.PL that overrides any of the 
methods, has to list those methods in the overriden_method attribute that I've 
invented.

ModPerl::MM::WriteMakefile(
    ...
    overriden_method => \@methods
    ...
);

when this happens, ModPerl::MM won't install its default methods. Though we do 
want them to be called, so Makefile.PL has to call them, similar to what it 
did before calling $self->SUPER::whatever, e.g.:

sub ModPerl::MM::MY::top_targets {
     my $self = shift;
     my $string = $self->MM::top_targets();

     add_dep_after(\$string, "pure_all", pm_to_blib => 'glue_pods');

     return $string;
}

I don't know whether it's good or bad, but at least it enabled me to add the 
functionality to glue the pods. The patch is attached, because it includes 
tabs for Makefile.

Any chance ModPerl::MM can be made really a sub-classable module? If we do 
that, lots of headaches will be saved in the future.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com