From: Mischa POSLAWSKY Date: Sat, 24 Aug 2024 19:40:30 +0000 (+0200) Subject: tools: includes from relative or project paths X-Git-Tag: v1.20~9 X-Git-Url: http://git.shiar.net/sheet.git/commitdiff_plain/5ea795d4f04b3fd605c4dfcf547e1969f1eb39be?hp=133b9fc3c05af0a4a38d3e875d1627dcc8f8f256 tools: includes from relative or project paths More perl v5.26 fixes similar to commit v1.10-63-g00ffc9287b (2018-03-05) [fix includes from relative paths for perl v5.26], but restrict to project environment unless relying on many file dependencies. --- diff --git a/tools/lastword b/tools/lastword index b8e94f9..66709bf 100755 --- a/tools/lastword +++ b/tools/lastword @@ -1,7 +1,7 @@ #!/usr/bin/env -S perl -ni use 5.014; use warnings; -use lib '.'; +use lib $0 =~ s{[^/]+$}{..}r; # project root use Shiar_Sheet::DB; my $db = Shiar_Sheet::DB->connect; diff --git a/tools/mkdigraphs-xorg b/tools/mkdigraphs-xorg index 64c99d9..4d25445 100755 --- a/tools/mkdigraphs-xorg +++ b/tools/mkdigraphs-xorg @@ -4,6 +4,7 @@ use warnings; use utf8; use open IO => ':encoding(utf-8)', ':std'; use re '/msx'; +use lib '.'; use JSON 'decode_json'; use Data::Dump 'pp'; use Shiar_Sheet::FormatChar; diff --git a/tools/mkjson b/tools/mkjson index 3b1bfa9..c2c89fd 100755 --- a/tools/mkjson +++ b/tools/mkjson @@ -2,6 +2,7 @@ use 5.012; use warnings; use re '/msx'; +use lib '.'; use JSON; our $VERSION = '1.00'; diff --git a/tools/mktermcol-xcolor b/tools/mktermcol-xcolor index c705093..c59b731 100755 --- a/tools/mktermcol-xcolor +++ b/tools/mktermcol-xcolor @@ -1,7 +1,7 @@ #!/usr/bin/env perl use 5.014; - -BEGIN { push @INC, '.'; } +use warnings; +use lib $0 =~ s{[^/]+$}{..}r; # project root use Shiar_Sheet::Colour 1.05; say "# automatically generated by $0"; diff --git a/tools/mkwordlist b/tools/mkwordlist index 7611b9f..7c71fae 100755 --- a/tools/mkwordlist +++ b/tools/mkwordlist @@ -1,10 +1,10 @@ #!/usr/bin/env perl use 5.014; use warnings; +use open ':std' => ':encoding(utf-8)'; +use lib $0 =~ s{[^/]+$}{..}r; # project root -BEGIN { push @INC, '.' } use Shiar_Sheet::DB; -use open ':std' => ':encoding(utf-8)'; my $db = Shiar_Sheet::DB->connect; say 'use utf8;'; diff --git a/tools/mkwordthumb b/tools/mkwordthumb index d79a002..34c3b6a 100755 --- a/tools/mkwordthumb +++ b/tools/mkwordthumb @@ -1,7 +1,7 @@ #!/usr/bin/env perl use 5.014; use warnings; -use lib '.'; +use lib $0 =~ s{[^/]+$}{..}r; # project root use Shiar_Sheet::ImagePrep; use Shiar_Sheet::DB; use JSON (); diff --git a/tools/wordpairs b/tools/wordpairs index 9ba87f4..8dce285 100755 --- a/tools/wordpairs +++ b/tools/wordpairs @@ -1,7 +1,7 @@ #!/usr/bin/env perl use 5.014; use warnings; -use lib '.'; +use lib $0 =~ s{[^/]+$}{..}r; # project root use Shiar_Sheet::DB; use Data::Dump 'pp';