summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Config.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-08-05 22:36:42 +0000
committerfukachan <fukachan>2001-08-05 22:36:42 +0000
commit13e5488261d1b881f36fc8ee18cf62401946ea1d (patch)
treece061468c7c792c9d493c19bde684810a10eb0c2 /fml/lib/FML/Config.pm
parent818f68a3ddadc3aaffc3c430812be8058027cfbc (diff)
downloadfml8-13e5488261d1b881f36fc8ee18cf62401946ea1d.tar.gz
fml8-13e5488261d1b881f36fc8ee18cf62401946ea1d.tar.bz2
fml8-13e5488261d1b881f36fc8ee18cf62401946ea1d.zip
template of config.cf modification
Diffstat (limited to 'fml/lib/FML/Config.pm')
-rw-r--r--fml/lib/FML/Config.pm20
1 files changed, 15 insertions, 5 deletions
diff --git a/fml/lib/FML/Config.pm b/fml/lib/FML/Config.pm
index 9ac8e4c8..5cc6eb12 100644
--- a/fml/lib/FML/Config.pm
+++ b/fml/lib/FML/Config.pm
@@ -1,7 +1,7 @@
#-*- perl -*-
# Copyright (C) 2000-2001 Ken'ichi Fukamachi
#
-# $FML: Config.pm,v 1.35 2001/07/15 08:38:22 fukachan Exp $
+# $FML: Config.pm,v 1.36 2001/07/15 23:35:37 fukachan Exp $
#
package FML::Config;
@@ -148,6 +148,12 @@ sub set
}
+sub regist
+{
+ my ($self, $key) = @_;
+ push(@{ $self->{ _newly_added_keys } }, $key);
+}
+
=head2 C<overload( filename )>
@@ -335,14 +341,18 @@ sub write
my $fh = IO::File::Atomic->open($file);
# back up config.cf firstly
- my $st = IO::File::Atomic->copy($file, $file.".bak");
- unless ($st) {
- Log("cannot backup $file");
+ my $status = IO::File::Atomic->copy($file, $file.".bak");
+ unless ($status) {
+ croak "cannot backup $file";
}
if (defined $fh) {
$fh->autoflush(1);
- for my $k (@$order) {
+
+ # XXX it works not well ??? ( regist() not works ??)
+ # XXX get variable list modified in this process
+ my $newkeys = $self->{ _newly_added_keys };
+ for my $k (@$order, @$newkeys) {
print $fh $comment->{$k} if defined $comment->{$k};
print $fh "$k = ";
print $fh join("\n\t", split(/\s+/, $config->{$k}));