From d5817a26c72d21ea807d522492faa6105da2d085 Mon Sep 17 00:00:00 2001 From: Rene Kita Date: Fri, 14 Jan 2022 13:10:46 +0100 Subject: [PATCH] Use strict and warnings in posubst --- posubst.in | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/posubst.in b/posubst.in index a2c445f..f542e0d 100644 --- a/posubst.in +++ b/posubst.in @@ -1,12 +1,15 @@ #!@PERL@ # gettext message substitute # -$po_dir='po'; -$lang='@POLANG@'; -%msg = (); -$msgid = ''; -$charset = "UTF-8"; -$charset_code = "WC_CES_UTF_8"; +use strict; +use warnings; + +my $po_dir='po'; +my $lang='@POLANG@'; +my %msg = (); +my $msgid = ''; +my $charset = "UTF-8"; +my $charset_code = "WC_CES_UTF_8"; open(PO, "$po_dir/$lang.po") or die "cannot open $po_dir/$lang.po, $!"; while () { if (/^msgid\s*"(.*)"/) { @@ -25,7 +28,7 @@ while () { close(PO); open(CL, "charset-list") or die "cannot open charset-list, $!"; while () { - @l = split; + my @l = split; if ($l[0] eq $charset) { $charset_code = $l[1]; last; @@ -33,9 +36,9 @@ while () { } close(CL); -@src = grep {/\.c$/} @ARGV; -@tmp = (); -foreach $src (@src) { +my @src = grep {/\.c$/} @ARGV; +my @tmp = (); +foreach my $src (@src) { open(SRC0, $src) or die "cannot open $src, $!"; push(@tmp, ".$src"); open(SRC1, ">.$src") or die "cannot create .$src, $!";