[Po4a-commits] po4a/lib/Locale/Po4a TransTractor.pm,1.39,1.40

Martin Quinson po4a-devel@lists.alioth.debian.org
Sun, 15 Aug 2004 07:57:03 +0000


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

Modified Files:
	TransTractor.pm 
Log Message:
map doesn't do the trick since we need to shift content within the loop (to pass until the end boundary). So, let's go for a do {shift;blabla} while (scalar @toto);

Index: TransTractor.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TransTractor.pm,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- TransTractor.pm	15 Aug 2004 07:18:08 -0000	1.39
+++ TransTractor.pm	15 Aug 2004 07:57:01 -0000	1.40
@@ -621,10 +621,11 @@
                                         }  @{$self->{TT}{doc_out}};
     } else {
 	my @newres=();
-	map {
-	    my $line = $_;
+
+	do {
+	    # make sure it doesnt whine on empty document
+	    my $line = scalar @{$self->{TT}{doc_out}} ? shift @{$self->{TT}{doc_out}} : "";
 	    push @newres,$line;
-	    print STDERR "Consider $line" if $self->debug();
 	    my $outline=mychomp($line);
 	    $outline =~ s/^[ \t]*//;
 	      
@@ -656,7 +657,7 @@
 		    push @newres,$content;
 		}
 	    }
-	} @{$self->{TT}{doc_out}};
+	} while (scalar @{$self->{TT}{doc_out}});
 	@{$self->{TT}{doc_out}} = @newres;
     }
     print STDERR "done.\n" if $self->debug();