summaryrefslogtreecommitdiff
path: root/regen
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-04-14 03:17:40 +0200
committerKarl Williamson <khw@cpan.org>2022-04-19 05:41:19 -0600
commit22c7467e111ce45b0cf3997c7864582cfeb7a117 (patch)
treed9aa94cb812560847f041281400c801d47fdb637 /regen
parentd6945b2c7963b5f1e22f90b7aab16077aa2edd27 (diff)
downloadperl-22c7467e111ce45b0cf3997c7864582cfeb7a117.tar.gz
regen/mk_invlists.pl - add a way to dump the keywords hash for review
This adds a way to tell mk_invlists.pl to dump the keywords hash so it can be reviewed, or used for testing or whatnot. A user can define the env var DUMP_KEYWORDS_FILE to be a file name which will be used to save the keywords hash to. If the env var is not set the file won't get written to disk. Includes regenerated output from running regen/mk_invlists.pl to keep porting/regen.t happy.
Diffstat (limited to 'regen')
-rw-r--r--regen/mk_invlists.pl11
1 files changed, 10 insertions, 1 deletions
diff --git a/regen/mk_invlists.pl b/regen/mk_invlists.pl
index 815a28b4e5..e5259aa118 100644
--- a/regen/mk_invlists.pl
+++ b/regen/mk_invlists.pl
@@ -3350,7 +3350,16 @@ my $uni_pl = open_new('lib/unicore/uni_keywords.pl', '>',
read_only_bottom_close_and_rename($uni_pl, \@sources);
-
+if (my $file= $ENV{DUMP_KEYWORDS_FILE}) {
+ require Data::Dumper;
+
+ open my $ofh, ">", $file
+ or die "Failed to open DUMP_KEYWORDS_FILE '$file' for write: $!";
+ print $ofh Data::Dumper->new([\%keywords],['*keywords'])
+ ->Sortkeys(1)->Useqq(1)->Dump();
+ close $ofh;
+ print "Wrote keywords to '$file'.\n";
+}
my $keywords_fh = open_new('uni_keywords.h', '>',
{style => '*', by => 'regen/mk_invlists.pl',