- Avoid circular `use Config', which may lead to random synax errors
produced by miniperl during buildworld phase. - While at it, do loading of SelfLoader only when it is needed, and in place where it is needed. Submitted by: tobez@tobez.org (who is doing way too much good work and is in need of the Commit Bit punishment)
This commit is contained in:
parent
21ac6df7ff
commit
2a7d49a804
gnu/usr.bin/perl/BSDPAN
@ -11,7 +11,6 @@ package BSDPAN;
|
||||
#
|
||||
# The pod documentation for this module is at the end of this file.
|
||||
#
|
||||
use Config;
|
||||
|
||||
my $bsdpan_path; # Directory pathname of BSDPAN itself
|
||||
|
||||
@ -34,19 +33,22 @@ sub path {
|
||||
}
|
||||
|
||||
sub perl_version {
|
||||
return $Config{version};
|
||||
require Config;
|
||||
return $Config::Config{version};
|
||||
}
|
||||
|
||||
sub perl_ver {
|
||||
require Config;
|
||||
# pre-5.6.0 perls
|
||||
return $Config{apiversion} if exists $Config{apiversion};
|
||||
return $Config::Config{apiversion} if exists $Config::Config{apiversion};
|
||||
# post-5.6.0 perls
|
||||
return $Config{version};
|
||||
return $Config::Config{version};
|
||||
}
|
||||
|
||||
sub perl_arch {
|
||||
require Config;
|
||||
# pre-5.6.0 perls
|
||||
return $Config{archname} if exists $Config{apiversion};
|
||||
return $Config::Config{archname} if exists $Config::Config{apiversion};
|
||||
# post-5.6.0 perls
|
||||
return 'mach';
|
||||
}
|
||||
|
@ -13,9 +13,8 @@ package BSDPAN::Override;
|
||||
#
|
||||
use strict;
|
||||
use Carp;
|
||||
use BSDPAN;
|
||||
require Exporter;
|
||||
require SelfLoader; # XXX 2nd-order magic over SelfLoader's magic :-)
|
||||
# require AutoLoader; # XXX do we need to do similar hoop-la with it?
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
@ISA = qw(Exporter);
|
||||
@ -77,8 +76,11 @@ sub override ($$) {
|
||||
|
||||
# do we need to protect against SelfLoader?
|
||||
my $sl_autoload = eval "*$pkg\::AUTOLOAD{CODE}";
|
||||
$sl_autoload = 0
|
||||
if $sl_autoload && $sl_autoload != \&SelfLoader::AUTOLOAD;
|
||||
if ($sl_autoload) {
|
||||
require SelfLoader;
|
||||
$sl_autoload = 0
|
||||
if $sl_autoload != \&SelfLoader::AUTOLOAD;
|
||||
}
|
||||
|
||||
# get the reference to the original sub
|
||||
my $name_addr = eval "*$name\{CODE}";
|
||||
|
Loading…
Reference in New Issue
Block a user