diff options
author | Bill Meier <wmeier@newsguy.com> | 2013-02-08 16:25:46 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2013-02-08 16:25:46 +0000 |
commit | f5dd71e30e36a14abcb33c9886a47784d7eab1f1 (patch) | |
tree | 9f2f1983b89439fd565e695d7a7c92f536b70f9f /tools/checkhf.pl | |
parent | 73b49715c9b94661079401aa192cd55e88e2147a (diff) |
Fix code to delete blank lines to remove all blank lines;
Update some Perl usage.
svn path=/trunk/; revision=47569
Diffstat (limited to 'tools/checkhf.pl')
-rwxr-xr-x | tools/checkhf.pl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/checkhf.pl b/tools/checkhf.pl index 5edaabdd3f..3943bdd7b9 100755 --- a/tools/checkhf.pl +++ b/tools/checkhf.pl @@ -139,6 +139,7 @@ while (my $fileName = $ARGV[0]) { ## $noArrayHRef = diff_hash(\%hfDefs, \%hfArrayEntries); $noArrayHRef = diff_hash(\%hfStaticDefs, \%hfArrayEntries); $noArrayHRef = diff_hash($noArrayHRef, $unUsedHRef); # Remove "unused" hf_... from noArray list + print_list("ERROR: NO ARRAY: $fileName, ", $noArrayHRef); if ((keys %$noArrayHRef) != 0) { @@ -168,13 +169,12 @@ sub read_file { # delete leading './' $$fileNameRef =~ s{ ^ \. / } {}xo; - $$fileContentsRef = ''; # Read in the file (ouch, but it's easier that way) - open(FCI, "<", $$fileNameRef) || die("Couldn't open $$fileNameRef"); - while (<FCI>) { - $$fileContentsRef .= $_; - } - close(FCI); + open(my $fci, "<:crlf", $$fileNameRef) || die("Couldn't open $$fileNameRef"); + + $$fileContentsRef = do { local( $/ ) ; <$fci> } ; + + close($fci); return; } @@ -216,7 +216,7 @@ sub print_list { sub remove_blank_lines { my ($codeRef, $fileName) = @_; - $$codeRef =~ s { ^ \s* $ } []xomg; + $$codeRef =~ s { ^ \s* \n } []xomg; return; } |