diff options
-rw-r--r-- | gnu/usr.bin/perl/BSDPAN/BSDPAN/Override.pm | 18 | ||||
-rw-r--r-- | gnu/usr.bin/perl/BSDPAN/ExtUtils/MM_Unix.pm | 22 |
2 files changed, 30 insertions, 10 deletions
diff --git a/gnu/usr.bin/perl/BSDPAN/BSDPAN/Override.pm b/gnu/usr.bin/perl/BSDPAN/BSDPAN/Override.pm index f7e8030..5e667ee 100644 --- a/gnu/usr.bin/perl/BSDPAN/BSDPAN/Override.pm +++ b/gnu/usr.bin/perl/BSDPAN/BSDPAN/Override.pm @@ -93,14 +93,16 @@ sub override ($$) { # Ouch! Don't ask. :-) eval <<EOF; *$name = sub { - \$replacement_sub->( sub { - \$SelfLoader::AUTOLOAD = "$name"; - local \$SIG{__WARN__} = sub {}; - my \@r = \$sl_autoload->(\@_); - my \$real_addr = "*$name\{CODE}"; - *$name = sub { \$replacement_sub->( - \$real_addr, \@_) }; - }, \@_) + \$replacement_sub->( sub { + \$SelfLoader::AUTOLOAD = "$name"; + local \$SIG{__WARN__} = sub {}; + my \@r = \$sl_autoload->(\@_); + my \$real_addr = eval "*$name\{CODE}"; + my \$repsub2 = \$replacement_sub; + eval "*\$name = sub { + \\\$repsub2->( + \\\$real_addr, \\\@_) };"; + }, \@_) }; EOF } else { diff --git a/gnu/usr.bin/perl/BSDPAN/ExtUtils/MM_Unix.pm b/gnu/usr.bin/perl/BSDPAN/ExtUtils/MM_Unix.pm index 43acdae..5bfcf59 100644 --- a/gnu/usr.bin/perl/BSDPAN/ExtUtils/MM_Unix.pm +++ b/gnu/usr.bin/perl/BSDPAN/ExtUtils/MM_Unix.pm @@ -24,7 +24,9 @@ sub init_main { # MakeMaker insist to use perl system path first; # free it of this misconception, since we know better. - $him->{PERL_LIB} = BSDPAN->path; + $him->{PERL_LIB_REAL} = $him->{PERL_LIB}; + $him->{PERL_LIB_BSDPAN} = BSDPAN->path; + $him->{PERL_LIB} = $him->{PERL_LIB_BSDPAN}; # MakeMaker is pretty lame when the user specifies PREFIX. # It has too fine granularity regarding the various places @@ -57,8 +59,20 @@ sub init_main { return @r; } +sub tool_xsubpp { + my $orig = shift; + my $him = $_[0]; + + $him->{PERL_LIB} = $him->{PERL_LIB_REAL}; + my @r = &$orig; + $him->{PERL_LIB} = $him->{PERL_LIB_BSDPAN}; + + return @r; +} + BEGIN { override 'init_main', \&init_main; + override 'tool_xsubpp', \&tool_xsubpp; } 1; @@ -72,7 +86,7 @@ BSDPAN::ExtUtils::MM_Unix - Override ExtUtils::MM_Unix functionality =head1 DESCRIPTION -BSDPAN::ExtUtils::MM_Unix overrides init_main() sub of the standard perl +BSDPAN::ExtUtils::MM_Unix overrides two subs from the standard perl module ExtUtils::MM_Unix. The overridden init_main() first calls the original init_main(). Then, @@ -80,6 +94,10 @@ if the Perl port build is detected, and the PREFIX stored in the ExtUtils::MM_Unix object is not F</usr/local/>, it proceeds to change various installation paths ExtUtils::MM_Unix maintains, to match PREFIX. +The overridden tool_xsubpp() sub temporarily undoes the change in the +environment done by the overridden init_main(), so that xsubpp(1) and +other XS tools will be searched in the right place. + Thus, BSDPAN::ExtUtils::MM_Unix is responsible for making p5- ports PREFIX-clean. |