[LON-CAPA-cvs] cvs: loncom / ConfigFileEdit.pm
foxr
lon-capa-cvs@mail.lon-capa.org
Tue, 30 Dec 2003 11:28:51 -0000
foxr Tue Dec 30 06:28:51 2003 EDT
Modified files:
/loncom ConfigFileEdit.pm
Log:
Add support to get the entire contents of an edited config file as a string.
Index: loncom/ConfigFileEdit.pm
diff -u loncom/ConfigFileEdit.pm:1.2 loncom/ConfigFileEdit.pm:1.3
--- loncom/ConfigFileEdit.pm:1.2 Tue Dec 2 07:06:25 2003
+++ loncom/ConfigFileEdit.pm Tue Dec 30 06:28:51 2003
@@ -313,6 +313,24 @@
}
}
+# Get:
+# return the entire contents of the file as a string.
+# Parameters:
+# $self - (this).
+#
+sub Get {
+ my $self = shift;
+
+ my $contents = "";
+ my $lines = $self->{LineArray};
+ my $length = @$lines;
+
+ for (my $i = 0; $i < $length; $i++) {
+ $contents .= $lines->[$i]."\n";
+ }
+ return $contents;
+}
+
1;
#----------------------------- Documentation --------------------------------------
#
@@ -427,6 +445,10 @@
=back
+=head2 Get ()
+
+Return the entire contents of the configuration file as a single string.
+
=head2 Comment ( line )
Static member that returns true if the line passed in is a comment or blank line.
@@ -442,6 +464,8 @@
=item * index - The index requested (0 is the first field on the line).
=back
+
+
=head2 Index ( linearray, fieldno )