tools: fix includes from relative paths for perl v5.26
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 15 Nov 2017 09:15:22 +0000 (10:15 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 5 Mar 2018 22:51:17 +0000 (23:51 +0100)
Data is assumed to be located relative to script directories.
Like previous commit v1.10-62-gce551a5d55 (2018-03-05)
[common: include from cwd to work around perl v5.26 security].

tools/mkdigraphlist
tools/mkfontinfo
tools/mktermcol-xcolor

index 38978b62d563279f3ca0e5e9311256f6fa1e733f..2d1fdbd8380b27cb4d620e5d99bee3ac110bee45 100755 (executable)
@@ -9,18 +9,19 @@ use open OUT => ':utf8', ':std';
 our $VERSION = '1.06';
 
 # import and combine various digraph data
-my $rfc = do 'data/digraphs-rfc.inc.pl'
+push @INC, 'data';
+my $rfc = do 'digraphs-rfc.inc.pl'
        or die "error reading digraphs include: ", $@ // $!;
-my $extra = do 'data/digraphs-shiar.inc.pl'
+my $extra = do 'digraphs-shiar.inc.pl'
        or warn "could not include shiar proposals: ", $@ // $!;
-my $vim = do 'data/digraphs-vim.inc.pl'
+my $vim = do 'digraphs-vim.inc.pl'
        or warn "could not include vim extensions ", $@ // $!;
-my $vimold = do 'data/digraphs-vim-74.inc.pl'
+my $vimold = do 'digraphs-vim-74.inc.pl'
        or warn "could not include vim compatibility ", $@ // $!;
 my $di = { %{$vim // {}}, %{$rfc}, %{$extra // {}} };
 
 # optionally get unicode character information
-my $uninfo = do 'data/unicode-char.inc.pl'
+my $uninfo = do 'unicode-char.inc.pl'
        or warn "could not include unicode details: ", $@ // $!;
 
 # output perl code of hash
index b27b779fa86766b1fc2cd7e7c0fae0351e100ec4..e7cd4f53183c6de1cc7654c92de39b4331e0d83c 100755 (executable)
@@ -15,7 +15,11 @@ my %cover;
 my $incsuffix = '.inc.pl';
 for my $fontfile (glob 'data/font/*'.$incsuffix) {
        my ($fontid) = basename($fontfile, $incsuffix);
-       my ($fontmeta, @fontrange) = do $fontfile or next;
+       my ($fontmeta, @fontrange) = do "./$fontfile";
+       if (!$fontmeta) {
+               warn "$fontfile: $!";
+               next;
+       }
        $fontmeta->{file} = $fontid;
        my $year = substr $fontmeta->{date}, 0, 4;
        $fontmeta->{description} = join(' ',
@@ -31,7 +35,7 @@ my %charlist;
 
 $charlist{table}->{abc} = ['A'..'Z', 'a'..'z'];
 
-my $chartables = do 'unicode-table.inc.pl' or warn $@ || $!;
+my $chartables = do './unicode-table.inc.pl' or warn $@ || $!;
 if ($chartables) {
        while (my ($tablegroup, $grouprow) = each %{$chartables}) {
                while (my ($tablename, $chars) = each %{$grouprow}) {
@@ -65,7 +69,7 @@ eval {
 } or warn "Could not include count for html entities: $@";
 
 eval {
-       my $agemap = do 'data/unicode-age.inc.pl'
+       my $agemap = do './data/unicode-age.inc.pl'
                or warn "Could not include unicode version data: $!";
 
        use Unicode::UCD 'charinfo';
index 7f39c80c4ca6332805c108d80c0c362da8c24623..c705093924dc96748f18a56683d6863e285a390a 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/env perl
 use 5.014;
 
+BEGIN { push @INC, '.'; }
 use Shiar_Sheet::Colour 1.05;
 
 say "# automatically generated by $0";