Closed sidney closed 2 years ago
There is a fixed set of methods that are overridable via MY
. pm_to_blib
is not included in that list. The code (https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/blob/master/lib/ExtUtils/MakeMaker.pm#L380-L384) makes it look like it is intentionally excluded, but it's not at all obvious why.
Ah, I missed how pm_to_blib and self_document are in the middle there being left out of @Overridable when everything else is being put in it. I guess I'll close this as intended behavior for some reason. Thanks.
I have not been able to override the pm_to_blib method after reducing to the following simplified test case.
I created a small test module by running
h2xs -ACPX -n Hello::World -v 1.0
I then edited the generated Makefile.pl to add the following at the end, which overrides both c_o and pm_to_blib based on the perldoc example for overriding c_o.
When I run
perl Makefile.PL
the output shows that MY::c_o was called as expected, but not MY::pm_to_blibThe cluck output in MY::c_o showed that it was called with $self being a package named PACK001. When I change
sub pm_to_lib
tosub PACK001::pm_to_lib
then it does get called, although of course that is not a proper workaround.I tried this both on macOS with perl 5.34.0 ExtUtils::MakeMaker version 7.62 and on Ubuntu with perl 5.36.0 ExtUtils::MakeMaker 7.64 with no change in results.
Looking in the source code and adding debugging logging, I see that both c_o and pm_to_blib are defined in MM_UNIX.pm the same way, and they are both called by the same lines of code that are in a loop in MakeMaker.pm with the same PACK001 package object in $self, so I can't see why they should act different.