[Po4a-commits] po4a/lib/Locale/Po4a TransTractor.pm,1.55,1.56

Martin Quinson po4a-devel@lists.alioth.debian.org
Sun, 23 Jan 2005 00:23:33 +0000


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

Modified Files:
	TransTractor.pm 
Log Message:
More fixups to the module example

Index: TransTractor.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TransTractor.pm,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- TransTractor.pm	22 Jan 2005 23:32:24 -0000	1.55
+++ TransTractor.pm	23 Jan 2005 00:23:30 -0000	1.56
@@ -118,15 +118,18 @@
 of each paragraph.
 
  sub parse {
+   my $self = shift;
+
    PARAGRAPH: while (1) {
        my ($paragraph,$pararef,$line,$lref)=("","","","");
        my $first=1;
-       while (($line,$lref)=$document->shiftline() && defined($line)) {
+       my ($line,$lref)=$self->shiftline();
+       while (defined($line)) {
 	   if ($line =~ m/<p>/ && !$first--; ) {
 	       # Not the first time we see <p>. 
 	       # Reput the current line in input,
 	       #  and put the built paragraph to output
-	       $document->unshiftline($line,$lref);
+	       $self->unshiftline($line,$lref);
 	      
 	       # Now that the document is formed, translate it:
 	       #   - Remove the leading tag
@@ -134,9 +137,9 @@
 
 	       #   - push to output the leading tag (untranslated) and the
 	       #     rest of the paragraph (translated)
-	       $document->pushline(  "<p>"
-                                   . $document->translate($paragraph,$pararef)
-                                   );
+	       $self->pushline(  "<p>"
+                               . $document->translate($paragraph,$pararef)
+                               );
 
  	       next PARAGRAPH;
 	   } else {
@@ -144,6 +147,9 @@
 	       $paragraph .= $line;
 	       $pararef = $lref unless(length($pararef));
 	   }
+
+           # Reinit the loop
+           ($line,$lref)=$self->shiftline();
        }
        # Did not got a defined line? End of input file.
        return;