summaryrefslogtreecommitdiff
path: root/ext/Errno
diff options
context:
space:
mode:
authorTodd Rinaldo <toddr@cpan.org>2015-08-26 16:49:58 -0500
committerTony Cook <tony@develop-help.com>2015-08-27 11:54:53 +1000
commita9b708ba5552bfe8ce5d5a0291df60aca3b2e883 (patch)
treeaed7807d2ba4d12f86b9087e9e0973d2e840088a /ext/Errno
parentd2a9272722b0e544c349fbad8e2f2feba3cce4dd (diff)
downloadperl-a9b708ba5552bfe8ce5d5a0291df60aca3b2e883.tar.gz
Avoid %Config check on Errno load if it was built with PERL_BUILD_EXPAND_CONFIG_VARS
Any person who built perl with this environment variable already has locked their install to the given platform. Therefore this check should be unnecessary on those installs. This reduces runtime bloat because Config does not have to be loaded any time someone uses $! or Errno directly.
Diffstat (limited to 'ext/Errno')
-rw-r--r--ext/Errno/Errno_pm.PL15
1 files changed, 13 insertions, 2 deletions
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index c6bfa062dd..1d9c048275 100644
--- a/ext/Errno/Errno_pm.PL
+++ b/ext/Errno/Errno_pm.PL
@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
use Config;
use strict;
-our $VERSION = "1.23";
+our $VERSION = "1.24";
my %err = ();
@@ -278,13 +278,24 @@ sub write_errno_pm {
package Errno;
require Exporter;
-use Config;
use strict;
+EDQ
+
+ # Errno only needs Config to make sure it hasn't changed platforms.
+ # If someone set $ENV{PERL_BUILD_EXPAND_CONFIG_VARS} at build time,
+ # they've already declared perl doesn't need to worry about this risk.
+ if(!$ENV{'PERL_BUILD_EXPAND_CONFIG_VARS'}) {
+ print <<"CONFIG_CHECK_END";
+use Config;
"\$Config{'archname'}-\$Config{'osvers'}" eq
"$archname-$Config{'osvers'}" or
die "Errno architecture ($archname-$Config{'osvers'}) does not match executable architecture (\$Config{'archname'}-\$Config{'osvers'})";
+CONFIG_CHECK_END
+}
+
+ print <<"EDQ";
our \$VERSION = "$VERSION";
\$VERSION = eval \$VERSION;
our \@ISA = 'Exporter';