diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-09-21 16:31:41 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-09-21 16:31:41 +0100 |
commit | 881a210041fba07d64572d6daacf57235c173fee (patch) | |
tree | adaebda7e4a8cfd54d248d3126471c4c6816fbf4 /embed.pl | |
parent | a4c2757fffb03ea5afbba9313f45bf9f5cb6490e (diff) | |
download | perl-881a210041fba07d64572d6daacf57235c173fee.tar.gz |
In embed.pl, read embed.fnc into an array, rather than seeking and rereading.
Diffstat (limited to 'embed.pl')
-rwxr-xr-x | embed.pl | 39 |
1 files changed, 22 insertions, 17 deletions
@@ -94,6 +94,26 @@ EOW open IN, "embed.fnc" or die $!; +my @embed; + +while (<IN>) { + chomp; + next if /^:/; + while (s|\\$||) { + $_ .= <IN>; + chomp; + } + s/\s+$//; + my @args; + if (/^\s*(#|$)/) { + @args = $_; + } + else { + @args = split /\s*\|\s*/, $_; + } + push @embed, \@args; +} + # walk table providing an array of components in each line to # subroutine, printing the result sub walk_table (&@) { @@ -111,23 +131,8 @@ sub walk_table (&@) { $F = safer_open("$filename-new"); } print $F $leader if $leader; - seek IN, 0, 0; # so we may restart - while (<IN>) { - chomp; - next if /^:/; - while (s|\\$||) { - $_ .= <IN>; - chomp; - } - s/\s+$//; - my @args; - if (/^\s*(#|$)/) { - @args = $_; - } - else { - @args = split /\s*\|\s*/, $_; - } - my @outs = &{$function}(@args); + foreach (@embed) { + my @outs = &{$function}(@$_); print $F @outs; # $function->(@args) is not 5.003 } print $F $trailer if $trailer; |