[Po4a-commits] po4a/lib/Locale/Po4a TeX.pm,1.53,1.54 LaTeX.pm,1.5,1.6

Nicolas FRAN??OIS po4a-devel@lists.alioth.debian.org
Fri, 08 Apr 2005 23:56:32 +0000


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv26146/lib/Locale/Po4a

Modified Files:
	TeX.pm LaTeX.pm 
Log Message:
Just warn instead of dying when the documentclass cannot be found (e.g. in
the case of a standard documentclass).


Index: LaTeX.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/LaTeX.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- LaTeX.pm	3 Apr 2005 22:51:16 -0000	1.5
+++ LaTeX.pm	8 Apr 2005 23:56:28 -0000	1.6
@@ -104,7 +104,9 @@
     my $self = shift;
     my ($command,$variant,$opts,$args,$env) = (shift,shift,shift,shift,shift);
 
-    parse_definition_file($self,$args->[0].".cls");
+    # Only try to parse the file.  We don't want to fail or parse this file
+    # if it is a standard documentclass.
+    parse_definition_file($self, $args->[0].".cls", 1);
 
     my ($t,@e) = untranslated($self,$command,$variant,$opts,$args,$env);
 

Index: TeX.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TeX.pm,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- TeX.pm	3 Apr 2005 22:51:16 -0000	1.53
+++ TeX.pm	8 Apr 2005 23:56:28 -0000	1.54
@@ -914,7 +914,7 @@
 =cut
 
 sub parse_definition_file {
-    my ($self,$filename)=@_;
+    my ($self,$filename,$only_try)=@_;
 
     foreach (($my_dirname,
               defined($ENV{"TEXINPUTS"})?
@@ -926,9 +926,15 @@
         }
     }
 
-    open (IN,"<$filename")
-        || die wrap_mod("po4a::tex",
+    if (! open (IN,"<$filename")) {
+        warn wrap_mod("po4a::tex",
             dgettext("po4a", "Can't open %s: %s"), $filename, $!);
+        if (defined $only_try && $only_try) {
+            return;
+        } else {
+            exit 1;
+        }
+    }
     while (<IN>) {
         if (/^\s*%\s*po4a\s*:/) {
             parse_definition_line($self, $_);