diff options
author | Oliver Tappe | 2007-07-10 22:57:27 +0200 |
---|---|---|
committer | Oliver Tappe | 2007-07-10 22:57:27 +0200 |
commit | d5113273cf2cefd1db9942e4d743f455aa8f669a (patch) | |
tree | f51f0d84dbd40b62b12d6e30479464eba391eff3 /bin/devel-tools/extractTranslations.pl | |
parent | Adaptions for Ubu 7.04 and Bugfixes for older Versions (diff) | |
download | core-d5113273cf2cefd1db9942e4d743f455aa8f669a.tar.gz core-d5113273cf2cefd1db9942e4d743f455aa8f669a.tar.xz core-d5113273cf2cefd1db9942e4d743f455aa8f669a.zip |
* 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
Diffstat (limited to 'bin/devel-tools/extractTranslations.pl')
-rwxr-xr-x | bin/devel-tools/extractTranslations.pl | 20 |
1 files changed, 6 insertions, 14 deletions
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 = <F>; - 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 = <F>; - 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"; |