[interchange-cvs] interchange - jon modified eg/te

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Mon Jun 7 20:07:58 EDT 2004


User:      jon
Date:      2004-06-08 00:07:57 GMT
Modified:  eg       te
Log:
Fixed bug that misinterpreted file as having no data rows when last line
of file was empty.

Revision  Changes    Path
2.8       +7 -3      interchange/eg/te


rev 2.8, prev_rev 2.7
Index: te
===================================================================
RCS file: /var/cvs/interchange/eg/te,v
retrieving revision 2.7
retrieving revision 2.8
diff -u -u -r2.7 -r2.8
--- te	26 Nov 2002 15:21:56 -0000	2.7
+++ te	8 Jun 2004 00:07:56 -0000	2.8
@@ -84,7 +84,7 @@
 
 =head1 VERSION
 
-$Id: te,v 2.7 2002/11/26 15:21:56 jon Exp $
+$Id: te,v 2.8 2004/06/08 00:07:56 jon Exp $
 
 =head1 CHANGELOG
 
@@ -119,6 +119,9 @@
 2002-09-03. Add option -n to number rows in comments. Allow setting of
 persistent options in environment variable TE_OPTIONS.
 
+2004-06-07. Fixed bug that misinterpreted file as having no data rows
+when last line of file was empty.
+
 =cut
 
 use strict;
@@ -230,7 +233,8 @@
 		}
 		print OUT "#\n";
 	}
-	if (@fields) {
+	my $have_rows = ($. > 1);
+	if ($have_rows) {
 		print OUT <<EOF;
 # You can uncomment the following lines to use as a template for inserting
 # a new row into the table. Copy as many times as needed to add many rows.
@@ -244,7 +248,7 @@
 #
 EOF
 	}
-	print OUT join("\n", map { (@fields ? '#' : '') . $_ . ":" } @fieldnames);
+	print OUT join("\n", map { ($have_rows ? '#' : '') . $_ . ":" } @fieldnames);
 	print OUT "\n#\n";
 	close IN;
 	print OUT <<EOF;








More information about the interchange-cvs mailing list