Changeset 38740 for main/trunk/greenstone2
- Timestamp:
- 2024-02-13T17:10:07+13:00 (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/util.pm
r38298 r38740 27 27 28 28 use strict; 29 no strict 'subs'; 29 30 no strict 'refs'; # make an exception so we can use variables as filehandles 31 32 30 33 use FileUtils; 31 34 … … 35 38 use File::Copy; 36 39 use File::Basename; 40 41 use gsprintf; 42 use multiread; 43 37 44 # Config for getting the perlpath in the recommended way, though it uses paths that are 38 45 # hard-coded into the Config file that's generated upon configuring and compiling perl. … … 40 47 # but if launched with plain "perl" (no full-path), that will be just what it returns. 41 48 use Config; 49 42 50 # New module for file related utility functions - intended as a 43 51 # placeholder for an extension that allows a variety of different … … 2010 2018 } 2011 2019 2020 sub read_utf8_textfile { 2021 my ($input_filename) = @_; 2022 2023 my $text_file_content_raw = undef; 2024 2025 if (!open(TEXT_FILE,"<$input_filename")) { 2026 &gsprintf::gsprintf(STDERR, "util::read_utf8_file() {ReadTextFile.could_not_open_for_reading} ($!)\n", $input_filename); 2027 die "\n"; 2028 } 2029 2030 my $file_reader = new multiread(); 2031 $file_reader->set_handle('util::TEXT_FILE'); 2032 $file_reader->read_file(\$text_file_content_raw); 2033 2034 close(TEXT_FILE); 2035 2036 my $text_file_content = decode("utf8",$text_file_content_raw); 2037 2038 return $text_file_content; 2039 } 2040 2041 2012 2042 1;
Note:
See TracChangeset
for help on using the changeset viewer.