From 324421a41d575e97d2e7b2f51297e19771e9e4ef Mon Sep 17 00:00:00 2001 From: Bas Zoetekouw Date: Tue, 30 Sep 2008 19:30:03 +0000 Subject: Move read_file() to Local::Util. CVS version numbers check_trans.pl: 1.71 -> 1.72 Perl/Local/Util.pm: 1.1 -> 1.2 --- check_trans.pl | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'check_trans.pl') diff --git a/check_trans.pl b/check_trans.pl index 1248f13cf94..78af3632b56 100755 --- a/check_trans.pl +++ b/check_trans.pl @@ -90,7 +90,7 @@ FindBin::again(); # These modules reside under webwml/Perl use lib "$FindBin::Bin/Perl"; use Local::VCS ':all'; -use Local::Util 'uniq'; +use Local::Util qw/ uniq read_file /; use Local::WmlDiffTrans; use Webwml::TransCheck; use Webwml::TransIgnore; @@ -683,25 +683,6 @@ sub get_diff return $difftxt; } -#================================================= -##== read en entire file and return the text -##== -sub read_file -{ - my $filename = shift or die("Internal error: no file specified"); - - # slurp mode - local $/ = undef; - - # read the file - open( my $fd, '<', $filename ) - or die("Couldn't open file `$filename': $!\n"); - my $text = <$fd>; - close( $fd ); - - return $text; -} - #================================================= #== get a diff while trying to match html tags #== @@ -719,7 +700,9 @@ sub get_diff_txt my @english_txt = split( "\n", vcs_get_file( $english_file, $rev1 ) ); # Get translation file - my @transl_txt = split( "\n", read_file( $transl_file ) ); + my $transl_txt = read_file( $transl_file ) + or die("Couln't read `$transl_file': $!"); + my @transl_txt = split( "\n", $transl_txt ); # Get diff lines my @diff_txt = split( "\n", get_diff( $english_file, $rev1, $rev2 ) ); -- cgit v1.2.3