From d5113273cf2cefd1db9942e4d743f455aa8f669a Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Tue, 10 Jul 2007 20:57:27 +0000 Subject: * more work towards perlcritic compliance, fixed the low-hanging fruit for level 4 git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1234 95ad53e4-c205-0410-b2fa-d234c58c8868 --- bin/devel-tools/extractTranslations.pl | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'bin/devel-tools/extractTranslations.pl') diff --git a/bin/devel-tools/extractTranslations.pl b/bin/devel-tools/extractTranslations.pl index 9bef83c9..eab71f04 100755 --- a/bin/devel-tools/extractTranslations.pl +++ b/bin/devel-tools/extractTranslations.pl @@ -15,6 +15,7 @@ # and modules. # ----------------------------------------------------------------------------- use strict; +use warnings; my $abstract = q[ extractTranslations.pl @@ -32,6 +33,8 @@ use File::Find; use Getopt::Long; use Pod::Usage; +use OpenSLX::Utils; + my ( $helpReq, $show, @@ -86,11 +89,7 @@ sub ExtractTrStrings || $_ eq 'Translations' || $_ eq 'devel-tools'); return if -d; - open(F, "< $_") - or die "could not open file $_ for reading!"; - local $/ = undef; - my $text = ; - close(F); + my $text = slurpFile($_); if ($File::Find::name !~ m[\.pm$] && $text !~ m[^#!.+/perl]im) { # ignore anything other than perl-modules and -scripts return; @@ -129,11 +128,7 @@ sub UpdateTrModule print "updating $File::Find::name...\n"; my $trModule = $_; my $useKeyAsTranslation = ($trModule eq 'posix.pm'); - open(F, "< $trModule") - or die "could not open file $trModule for reading!"; - $/ = undef; - my $text = ; - close(F); + my $text = slurpFile($trModule); if ($text !~ m[%translations\s*=\s*\(\s*(.+)\s*\);]os) { print "\t*** No translations found - file will be skipped! ***\n"; return; @@ -188,10 +183,7 @@ sub UpdateTrModule [$updatedTranslations);]os; if ($newCount + $delCount) { chomp $text; - open(F, "> $trModule") - or die "could not open file $trModule for writing!"; - print F "$text\n"; - close(F); + spitFile($trModule, $text."\n"); print "\tadded $newCount strings, kept $keepCount and removed $delCount.\n"; } else { print "\tnothing changed\n"; -- cgit v1.2.3-55-g7522