texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/Common.pm (output_files_open_out): r


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm (output_files_open_out): return an error message based on $! if open failed, or undef.
Date: Thu, 11 Aug 2022 03:32:23 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 8588963d16 * tp/Texinfo/Common.pm (output_files_open_out): return an 
error message based on $! if open failed, or undef.
8588963d16 is described below

commit 8588963d16d50bd78c642b0a10df5b3828a0a18d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Aug 11 09:32:12 2022 +0200

    * tp/Texinfo/Common.pm (output_files_open_out): return an
    error message based on $! if open failed, or undef.
---
 ChangeLog                        |  5 +++++
 tp/DebugTexinfo/DebugTree.pm     |  5 +++--
 tp/TODO                          |  2 --
 tp/Texinfo/Common.pm             |  9 ++++++---
 tp/Texinfo/Convert/Converter.pm  | 10 ++++++----
 tp/Texinfo/Convert/DocBook.pm    | 13 +++++++------
 tp/Texinfo/Convert/HTML.pm       | 41 ++++++++++++++++++++++------------------
 tp/Texinfo/Convert/IXIN.pm       |  5 +++--
 tp/Texinfo/Convert/Info.pm       |  8 ++++----
 tp/Texinfo/Convert/LaTeX.pm      |  5 +++--
 tp/Texinfo/Convert/TexinfoXML.pm |  5 +++--
 tp/Texinfo/Convert/Text.pm       |  5 +++--
 tp/ext/epub3.pm                  | 20 ++++++++++++--------
 tp/init/chm.pm                   | 12 ++++++------
 tp/texi2any.pl                   | 18 ++++++++++--------
 15 files changed, 94 insertions(+), 69 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 541cfca282..51337eefa8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-08-11  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm (output_files_open_out): return an
+       error message based on $! if open failed, or undef.
+
 2022-08-10  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/LaTeX.pm (_convert): only one empty line
diff --git a/tp/DebugTexinfo/DebugTree.pm b/tp/DebugTexinfo/DebugTree.pm
index 9f390bae77..6a1ced956a 100644
--- a/tp/DebugTexinfo/DebugTree.pm
+++ b/tp/DebugTexinfo/DebugTree.pm
@@ -95,13 +95,14 @@ sub output($$)
     my $path_encoding;
     ($encoded_output_file, $path_encoding)
       = $self->encoded_output_file_name($output_file);
-    $fh = Texinfo::Common::output_files_open_out(
+    my $error_message;
+    ($fh, $error_message) = Texinfo::Common::output_files_open_out(
                              $self->output_files_information(), $self,
                                      $encoded_output_file);
     if (!$fh) {
       $self->document_error($self,
            sprintf(__("could not open %s for writing: %s"),
-                                    $output_file, $!));
+                                    $output_file, $error_message));
       return undef;
     }
   }
diff --git a/tp/TODO b/tp/TODO
index 613e0ee02b..478fc03b9a 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -17,8 +17,6 @@ xterm &
 Before next release
 ===================
 
-Texinfo::Common::output_files_open_out( should return $!
-
 Bugs
 ====
 
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 5c64082214..e4d153bfde 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -1209,6 +1209,8 @@ sub locate_init_file($$$)
 # $FILE_PATH is the file path, it should be a binary string.
 # If $USE_BINMODE is set, call binmode() to set binary mode.
 # $OUTPUT_ENCODING argument overrides the output encoding.
+# returns the opened filehandle, or undef if opening failed,
+# and the $! error message or undef if opening succeeded.
 sub output_files_open_out($$$;$$)
 {
   my $self = shift;
@@ -1230,11 +1232,12 @@ sub output_files_open_out($$$;$$)
     if ($self) {
       $self->{'unclosed_files'}->{$file_path} = \*STDOUT;
     }
-    return \*STDOUT;
+    return \*STDOUT, undef;
   }
   my $filehandle = do { local *FH };
   if (!open ($filehandle, '>', $file_path)) {
-    return undef;
+    my $error_message = $!;
+    return undef, $error_message;
   }
   # We run binmode to turn off outputting LF as CR LF under MS-Windows,
   # so that Info tag tables will have correct offsets.  This must be done
@@ -1254,7 +1257,7 @@ sub output_files_open_out($$$;$$)
     push @{$self->{'opened_files'}}, $file_path;
     $self->{'unclosed_files'}->{$file_path} = $filehandle;
   }
-  return $filehandle;
+  return $filehandle, undef;
 }
 
 # see the description of $SELF in output_files_open_out
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index e1cdb75837..d5e0f08023 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -370,13 +370,14 @@ sub output($$)
       my $path_encoding;
       ($encoded_outfile_name, $path_encoding)
         = $self->encoded_output_file_name($outfile_name);
-      $fh = Texinfo::Common::output_files_open_out(
+      my $error_message;
+      ($fh, $error_message) = Texinfo::Common::output_files_open_out(
                     $self->output_files_information(), $self,
                     $encoded_outfile_name);
       if (!$fh) {
         $self->document_error($self,
                  sprintf(__("could not open %s for writing: %s"),
-                                      $outfile_name, $!));
+                                      $outfile_name, $error_message));
         return undef;
       }
     } else {
@@ -424,13 +425,14 @@ sub output($$)
       my $file_fh;
       # open the file and output the elements
       if (!$files{$tree_unit_filename}->{'fh'}) {
-        $file_fh = Texinfo::Common::output_files_open_out(
+        my $error_message;
+        ($file_fh, $error_message) = Texinfo::Common::output_files_open_out(
                              $self->output_files_information(), $self,
                              $out_filepath);
         if (!$file_fh) {
           $self->document_error($self,
                 sprintf(__("could not open %s for writing: %s"),
-                       $out_filepath, $!));
+                       $out_filepath, $error_message));
           return undef;
         }
         $files{$tree_unit_filename}->{'fh'} = $file_fh;
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 0da4a082fe..2e0b24669d 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -327,19 +327,20 @@ sub output($$)
     my $path_encoding;
     ($encoded_output_file, $path_encoding)
       = $self->encoded_output_file_name($output_file);
-    $fh = Texinfo::Common::output_files_open_out(
-                             $self->output_files_information(), $self,
-                             $encoded_output_file);
+    my $error_message;
+    ($fh, $error_message) = Texinfo::Common::output_files_open_out(
+                              $self->output_files_information(), $self,
+                              $encoded_output_file);
     if (!$fh) {
       $self->document_error($self,
            sprintf(__("could not open %s for writing: %s"),
-                                    $output_file, $!));
+                                    $output_file, $error_message));
       return undef;
     }
   }
 
   my $encoding = '';
-  if ($self->get_conf('OUTPUT_ENCODING_NAME') 
+  if ($self->get_conf('OUTPUT_ENCODING_NAME')
       and $self->get_conf('OUTPUT_ENCODING_NAME') ne 'utf-8') {
     $encoding = " encoding=\"".$self->get_conf('OUTPUT_ENCODING_NAME')."\" ";
   }
@@ -526,7 +527,7 @@ my %docbook_sections = (
 );
 
 my %docbook_special_unnumbered;
-foreach my $special_unnumbered ('acknowledgements', 'colophon', 
+foreach my $special_unnumbered ('acknowledgements', 'colophon',
                                 'dedication', 'preface') {
   $docbook_special_unnumbered{$special_unnumbered} = 1;
 }
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index c575ec24d0..7bfc3449ac 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9070,9 +9070,10 @@ __("cannot use absolute path or URL `%s' for 
JS_WEBLABELS_FILE when generating w
   # sequence of bytes
   my ($licence_file_path, $path_encoding)
      = $self->encoded_output_file_name($license_file);
-  my $fh = Texinfo::Common::output_files_open_out(
-                 $self->output_files_information(), $self,
-                 $licence_file_path);
+  my ($fh, $error_message_licence_file)
+         = Texinfo::Common::output_files_open_out(
+                         $self->output_files_information(), $self,
+                         $licence_file_path);
   if (defined($fh)) {
     print $fh $a;
     Texinfo::Common::output_files_register_closed(
@@ -9085,7 +9086,7 @@ __("cannot use absolute path or URL `%s' for 
JS_WEBLABELS_FILE when generating w
   } else {
     $self->document_error($self,
            sprintf(__("could not open %s for writing: %s"),
-                                  $license_file, $!));
+                   $license_file, $error_message_licence_file));
   }
 }
 
@@ -9118,7 +9119,7 @@ sub _default_format_frame_files($$)
   # sequence of bytes
   my ($frame_file_path, $frame_path_encoding)
      = $self->encoded_output_file_name($frame_outfile);
-  my $frame_fh = Texinfo::Common::output_files_open_out(
+  my ($frame_fh, $error_message_frame) = 
Texinfo::Common::output_files_open_out(
                      $self->output_files_information(), $self, 
$frame_file_path);
   if (defined($frame_fh)) {
     my $doctype = $self->get_conf('FRAMESET_DOCTYPE');
@@ -9151,15 +9152,16 @@ EOT
   } else {
     $self->document_error($self,
            sprintf(__("could not open %s for writing: %s"),
-                                  $frame_outfile, $!));
+                                  $frame_outfile, $error_message_frame));
     return 0;
   }
   # sequence of bytes
   my ($toc_frame_path, $toc_frame_path_encoding)
        = $self->encoded_output_file_name($toc_frame_outfile);
-  my $toc_frame_fh = Texinfo::Common::output_files_open_out(
-                      $self->output_files_information(), $self,
-                      $toc_frame_path);
+  my ($toc_frame_fh, $toc_frame_error_message)
+           = Texinfo::Common::output_files_open_out(
+                               $self->output_files_information(), $self,
+                               $toc_frame_path);
   if (defined($toc_frame_fh)) {
 
     # this is needed to collect CSS rules.
@@ -9187,7 +9189,7 @@ EOT
   } else {
     $self->document_error($self,
            sprintf(__("could not open %s for writing: %s"),
-                                  $toc_frame_outfile, $!));
+                   $toc_frame_outfile, $toc_frame_error_message));
     return 0;
   }
   return 1;
@@ -9705,13 +9707,14 @@ sub output($$)
          = $self->{'out_filepaths'}->{$self->{'current_filename'}};
       ($encoded_no_page_out_filepath, $path_encoding)
         = $self->encoded_output_file_name($no_page_out_filepath);
-      $fh = Texinfo::Common::output_files_open_out(
-              $self->output_files_information(), $self,
-              $encoded_no_page_out_filepath);
+      my $error_message;
+      ($fh, $error_message) = Texinfo::Common::output_files_open_out(
+                                 $self->output_files_information(), $self,
+                                 $encoded_no_page_out_filepath);
       if (!$fh) {
         $self->document_error($self,
               sprintf(__("could not open %s for writing: %s"),
-                                      $no_page_out_filepath, $!));
+                                      $no_page_out_filepath, $error_message));
         return undef;
       }
     }
@@ -9805,13 +9808,14 @@ sub output($$)
         my $file_element = $files{$element_filename}->{'first_element'};
         my ($encoded_out_filepath, $path_encoding)
           = $self->encoded_output_file_name($out_filepath);
-        my $file_fh = Texinfo::Common::output_files_open_out(
+        my ($file_fh, $error_message)
+                = Texinfo::Common::output_files_open_out(
                          $self->output_files_information(), $self,
                          $encoded_out_filepath);
         if (!$file_fh) {
           $self->document_error($self,
                sprintf(__("could not open %s for writing: %s"),
-                                    $out_filepath, $!));
+                                    $out_filepath, $error_message));
           return undef;
         }
         # do end file first in case it requires some CSS
@@ -9917,13 +9921,14 @@ sub output($$)
         }
         my ($encoded_out_filename, $path_encoding)
           = $self->encoded_output_file_name($out_filename);
-        my $file_fh = Texinfo::Common::output_files_open_out(
+        my ($file_fh, $error_message)
+               = Texinfo::Common::output_files_open_out(
                              $self->output_files_information(), $self,
                              $encoded_out_filename);
         if (!$file_fh) {
          $self->document_error($self, sprintf(__(
                                     "could not open %s for writing: %s"),
-                                    $out_filename, $!));
+                                    $out_filename, $error_message));
         } else {
           print $file_fh $redirection_page;
           Texinfo::Common::output_files_register_closed(
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index a29f75b331..9c6277b3c9 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -282,13 +282,14 @@ sub output_ixin($$)
     my $path_encoding;
     ($encoded_output_file, $path_encoding)
       = $self->encoded_output_file_name($output_file);
-    $fh = Texinfo::Common::output_files_open_out(
+    my $error_message;
+    ($fh, $error_message) = Texinfo::Common::output_files_open_out(
                              $self->output_files_information(), $self,
                              $encoded_output_file);
     if (!$fh) {
       $self->document_error($self,
                 sprintf(__("could not open %s for writing: %s"),
-                                    $output_file, $!));
+                                    $output_file, $error_message));
       return undef;
     }
   }
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index d29f9dec80..d0692fe538 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -302,14 +302,14 @@ sub _open_info_file($$)
 
   my ($encoded_filename, $path_encoding)
       = $self->encoded_output_file_name($filename);
-  my $fh = Texinfo::Common::output_files_open_out(
-                             $self->output_files_information(), $self,
-                             $encoded_filename, 'use_binmode');
+  my ($fh, $error_message) = Texinfo::Common::output_files_open_out(
+                               $self->output_files_information(), $self,
+                               $encoded_filename, 'use_binmode');
 
   if (!$fh) {
     $self->document_error($self, sprintf(
         __("could not open %s for writing: %s"),
-        $filename, $!));
+        $filename, $error_message));
     return undef;
   }
   return $fh;
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 7be30a54d4..f90dbe3fc2 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -1009,13 +1009,14 @@ sub output($$)
     my $path_encoding;
     ($encoded_output_file, $path_encoding)
       = $self->encoded_output_file_name($output_file);
-    $fh = Texinfo::Common::output_files_open_out(
+    my $error_message;
+    ($fh, $error_message) = Texinfo::Common::output_files_open_out(
                              $self->output_files_information(), $self,
                              $encoded_output_file);
     if (!$fh) {
       $self->document_error($self,
              sprintf(__("could not open %s for writing: %s"),
-                                    $output_file, $!));
+                                    $output_file, $error_message));
       return undef;
     }
   }
diff --git a/tp/Texinfo/Convert/TexinfoXML.pm b/tp/Texinfo/Convert/TexinfoXML.pm
index 11ae9cdd25..94dc904f25 100644
--- a/tp/Texinfo/Convert/TexinfoXML.pm
+++ b/tp/Texinfo/Convert/TexinfoXML.pm
@@ -442,13 +442,14 @@ sub output($$)
     my $path_encoding;
     ($encoded_output_file, $path_encoding)
       = $self->encoded_output_file_name($output_file);
-    $fh = Texinfo::Common::output_files_open_out(
+    my $error_message;
+    ($fh, $error_message) = Texinfo::Common::output_files_open_out(
                              $self->output_files_information(), $self,
                              $encoded_output_file);
     if (!$fh) {
       $self->document_error($self,
                  sprintf(__("could not open %s for writing: %s"),
-                                    $output_file, $!));
+                                    $output_file, $error_message));
       return undef;
     }
   }
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index fb255b9c46..3096bb0093 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -803,12 +803,13 @@ sub output($$)
   if (defined($outfile)) {
     ($encoded_outfile, $outfile_encoding)
       = Texinfo::Convert::Utils::encoded_output_file_name($self, $outfile);
-    $fh = Texinfo::Common::output_files_open_out(
+    my $error_message;
+    ($fh, $error_message) = Texinfo::Common::output_files_open_out(
                              $self->{'output_files'}, $self,
                              $encoded_outfile);
     if (!$fh) {
       warn sprintf(__("could not open %s for writing: %s"),
-                  $outfile, $!)."\n";
+                   $outfile, $error_message)."\n";
       return undef;
     }
   }
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index 87e3ba8e54..64d80061a1 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -529,13 +529,14 @@ sub epub_finish($$)
                                            'container.xml');
   my ($encoded_container_file_path_name, $container_path_encoding)
     = $self->encoded_output_file_name($container_file_path_name);
-  my $container_fh = Texinfo::Common::output_files_open_out(
+  my ($container_fh, $error_message_container)
+            = Texinfo::Common::output_files_open_out(
                           $self->output_files_information(), $self,
                           $encoded_container_file_path_name, undef, 'utf-8');
   if (!defined($container_fh)) {
     $self->document_error($self,
          sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
-                  $container_file_path_name, $!));
+                  $container_file_path_name, $error_message_container));
     return 1;
   }
   my $document_name = $self->get_info('document_name');
@@ -564,13 +565,14 @@ EOT
                                                     $mimetype_filename);
   my ($encoded_mimetype_file_path_name, $mimetype_path_encoding)
     = $self->encoded_output_file_name($mimetype_file_path_name);
-  my $mimetype_fh = Texinfo::Common::output_files_open_out(
+  my ($mimetype_fh, $error_message_mimetype)
+               = Texinfo::Common::output_files_open_out(
                         $self->output_files_information(), $self,
                         $encoded_mimetype_file_path_name, undef, 'utf-8');
   if (!defined($mimetype_fh)) {
     $self->document_error($self,
          sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
-                  $mimetype_file_path_name, $!));
+                  $mimetype_file_path_name, $error_message_mimetype));
     return 1;
   }
   # There is no end of line.  It is not very clear in the standard, but
@@ -593,13 +595,14 @@ EOT
      = File::Spec->catfile($epub_document_destination_directory, 
$nav_filename);
     my ($encoded_nav_file_path_name, $nav_path_encoding)
       = $self->encoded_output_file_name($nav_file_path_name);
-    my $nav_fh = Texinfo::Common::output_files_open_out(
+    my ($nav_fh, $error_message_nav)
+           = Texinfo::Common::output_files_open_out(
                        $self->output_files_information(), $self,
                        $encoded_nav_file_path_name, undef, 'utf-8');
     if (!defined($nav_fh)) {
       $self->document_error($self,
            sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
-                    $nav_file_path_name, $!));
+                    $nav_file_path_name, $error_message_nav));
       return 1;
     }
     my $table_of_content_str = _epub_convert_tree_to_text($self,
@@ -701,13 +704,14 @@ EOT
                                         $epub_document_dir_name, 
$opf_filename);
   my ($encoded_opf_file_path_name, $opf_path_encoding)
     = $self->encoded_output_file_name($opf_file_path_name);
-  my $opf_fh = Texinfo::Common::output_files_open_out(
+  my ($opf_fh, $error_message_opf)
+            = Texinfo::Common::output_files_open_out(
                    $self->output_files_information(), $self,
                    $encoded_opf_file_path_name, undef, 'utf-8');
   if (!defined($opf_fh)) {
     $self->document_error($self,
          sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
-                  $opf_file_path_name, $!));
+                  $opf_file_path_name, $error_message_opf));
     return 1;
   }
   print $opf_fh <<EOT;
diff --git a/tp/init/chm.pm b/tp/init/chm.pm
index 4d439cb781..c675b4463e 100644
--- a/tp/init/chm.pm
+++ b/tp/init/chm.pm
@@ -220,13 +220,13 @@ sub chm_init($)
   my $hhk_file_path_name = File::Spec->catfile($outdir, $hhk_filename);
   my ($encoded_hhk_file_path_name, $hhk_path_encoding)
     = $self->encoded_output_file_name($hhk_file_path_name);
-  my $hhk_fh = Texinfo::Common::output_files_open_out(
+  my ($hhk_fh, $hhk_error_message) = Texinfo::Common::output_files_open_out(
                       $self->output_files_information(), $self,
                       $encoded_hhk_file_path_name);
   if (!defined($hhk_fh)) {
     $self->document_error($self,
          sprintf(__("chm.pm: could not open %s for writing: %s\n"),
-                  $hhk_file_path_name, $!));
+                  $hhk_file_path_name, $hhk_error_message));
     return 1;
   }
   print STDERR "# chm: writing HTML Help index in $hhk_file_path_name...\n"
@@ -270,13 +270,13 @@ sub chm_init($)
   my $hhc_file_path_name = File::Spec->catfile($outdir, $hhc_filename);
   my ($encoded_hhc_file_path_name, $hhc_path_encoding)
     = $self->encoded_output_file_name($hhc_file_path_name);
-  my $hhc_fh = Texinfo::Common::output_files_open_out(
+  my ($hhc_fh, $hhc_error_message) = Texinfo::Common::output_files_open_out(
                       $self->output_files_information(), $self,
                       $encoded_hhc_file_path_name);
   if (!defined($hhc_fh)) {
     $self->document_error($self,
          sprintf(__("chm.pm: could not open %s for writing: %s\n"),
-                  $hhc_file_path_name, $!));
+                  $hhc_file_path_name, $hhc_error_message));
     return 1;
   }
 
@@ -346,13 +346,13 @@ sub chm_init($)
   my $hhp_file_path_name = File::Spec->catfile($outdir, $hhp_filename);
   my ($encoded_hhp_file_path_name, $hhp_path_encoding)
     = $self->encoded_output_file_name($hhp_file_path_name);
-  my $hhp_fh = Texinfo::Common::output_files_open_out(
+  my ($hhp_fh, $hhp_error_message) = Texinfo::Common::output_files_open_out(
                       $self->output_files_information(), $self,
                       $encoded_hhp_file_path_name);
   if (!defined($hhp_fh)) {
     $self->document_error(
            $self, sprintf(__("chm.pm: could not open %s for writing: %s\n"),
-                  $hhp_file_path_name, $!));
+                  $hhp_file_path_name, $hhp_error_message));
     return 1;
   }
   print STDERR "# chm: writing HTML Help project in $hhp_file_path_name...\n"
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 13770fe0b1..f7b06c1f63 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1416,9 +1416,9 @@ while(@input_files) {
     my $encoded_macro_expand_file_name = get_conf('MACRO_EXPAND');
     my $macro_expand_file_name = 
_decode_input($encoded_macro_expand_file_name);
     my $macro_expand_files_information = {};
-    my $macro_expand_fh = Texinfo::Common::output_files_open_out(
-          $macro_expand_files_information, $main_configuration,
-          $encoded_macro_expand_file_name);
+    my ($macro_expand_fh, $error_message) = 
Texinfo::Common::output_files_open_out(
+                                $macro_expand_files_information, 
$main_configuration,
+                                $encoded_macro_expand_file_name);
     my $error_macro_expand_file;
     if (defined($macro_expand_fh)) {
       print $macro_expand_fh $texinfo_text;
@@ -1431,7 +1431,7 @@ while(@input_files) {
       }
     } else {
       document_warn(sprintf(__("could not open %s for writing: %s\n"), 
-                            $macro_expand_file_name, $!));
+                            $macro_expand_file_name, $error_message));
       $error_macro_expand_file = 1;
     }
     push @opened_files, Texinfo::Common::output_files_opened_files(
@@ -1620,9 +1620,10 @@ while(@input_files) {
     my $internal_links_file_name
         = _decode_input($encoded_internal_links_file_name);
     my $internal_links_files_information = {};
-    my $internal_links_fh = Texinfo::Common::output_files_open_out(
+    my ($internal_links_fh, $error_message)
+            = Texinfo::Common::output_files_open_out(
                               $internal_links_files_information, $converter,
-                                        $encoded_internal_links_file_name);
+                              $encoded_internal_links_file_name);
     my $error_internal_links_file;
     if (defined ($internal_links_fh)) {
       print $internal_links_fh $internal_links_text;
@@ -1636,7 +1637,7 @@ while(@input_files) {
            $internal_links_files_information, 
$encoded_internal_links_file_name);
     } else {
       warn(sprintf(__("%s: could not open %s for writing: %s\n"), 
-                      $real_command_name, $internal_links_file_name, $!));
+                      $real_command_name, $internal_links_file_name, 
$error_message));
       $error_internal_links_file = 1;
     }
 
@@ -1675,7 +1676,8 @@ while(@input_files) {
     # not right, should be changed by something not associated
     # with the converter but to the main program or file. parser
     # is not much better
-    my $sort_element_count_fh = Texinfo::Common::output_files_open_out(
+    my ($sort_element_count_fh, $error_message)
+                = Texinfo::Common::output_files_open_out(
                                $sort_elem_files_information, $converter,
                                     $encoded_sort_element_count_file_name);
     my $error_sort_element_count_file;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]