summaryrefslogtreecommitdiff
path: root/makedef.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-07-28 17:03:04 +0200
committerNicholas Clark <nick@ccl4.org>2011-08-01 11:53:57 +0200
commita6587d2d54d31fb38b3c64b9a10bf7d4eefc781b (patch)
tree91b54ecdd8bbd117c73e390114d57190673f930f /makedef.pl
parent60fae8969c3c2f50fa614da8ed36310784b903f5 (diff)
downloadperl-a6587d2d54d31fb38b3c64b9a10bf7d4eefc781b.tar.gz
In makedef.pl, refactor the code that reads *.sym files.
Hoist the test that chooses the prefix out of the loop. Tweak the regex to avoid needing an explicit chomp/ Use 3-arg open and a lexical for the file handle.
Diffstat (limited to 'makedef.pl')
-rw-r--r--makedef.pl16
1 files changed, 7 insertions, 9 deletions
diff --git a/makedef.pl b/makedef.pl
index 865b5ffeeb..e7d72e3dcc 100644
--- a/makedef.pl
+++ b/makedef.pl
@@ -731,17 +731,15 @@ if ($define{'USE_PERLIO'}) {
# many symbols against them.
for my $syms (@syms) {
- open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
- while (<GLOBAL>) {
- next if (!/^[A-Za-z]/);
- # Functions have a Perl_ prefix
- # Variables have a PL_ prefix
- chomp($_);
- my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
- $symbol .= $_;
+ open my $global, '<', $syms or die "failed to open $syms: $!\n";
+ # Functions already have a Perl_ prefix
+ # Variables need a PL_ prefix
+ my $prefix = $syms =~ /var\.sym$/i ? 'PL_' : '';
+ while (<$global>) {
+ next unless /^([A-Za-z].*)/;
+ my $symbol = "$prefix$1";
++$export{$symbol} unless exists $skip{$symbol};
}
- close(GLOBAL);
}
# variables