diff options
author | Bas Zoetekouw <bas> | 2008-09-30 19:30:03 +0000 |
---|---|---|
committer | Bas Zoetekouw <bas> | 2008-09-30 19:30:03 +0000 |
commit | 324421a41d575e97d2e7b2f51297e19771e9e4ef (patch) | |
tree | 390f6a399452a3e7ffd0b07b6c7b99948964ffea /check_trans.pl | |
parent | b8bbe054324844ae6cdfc1fcd64dc66bc7a1326c (diff) |
Move read_file() to Local::Util.
CVS version numbers
check_trans.pl: 1.71 -> 1.72
Perl/Local/Util.pm: 1.1 -> 1.2
Diffstat (limited to 'check_trans.pl')
-rwxr-xr-x | check_trans.pl | 25 |
1 files changed, 4 insertions, 21 deletions
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; @@ -684,25 +684,6 @@ sub get_diff } #================================================= -##== 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 #== sub get_diff_txt @@ -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 ) ); |