mirror of
https://codeberg.org/scip/Config-General.git
synced 2025-12-17 12:41:07 +01:00
1.32 - *argl* ... I forgot Interpolated.pm, don't know how that
could happen, in 1.29 it was "lost". However - I added it again now. - added patch by Peder Stray <peder@linpro.no> to the _store() method, which makes it possible to catch arrays of hashes to be stored correctly. - cleaned up the t/run.t testscript to reflect the changes (in fact I did not touch it since 1.18 or so). - added test number 16 to test variable interpolation using ::Interpolated in t/run.t. - fixed bug with new() parameter -AllowMultiOptions which generated a croak() if set to something other than "no". - changed Extended::save() to reflect the API change, it calls now save_file(). git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@21 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
22
General.pm
22
General.pm
@@ -18,7 +18,7 @@ use strict;
|
||||
use Carp;
|
||||
use Exporter;
|
||||
|
||||
$Config::General::VERSION = "1.30";
|
||||
$Config::General::VERSION = "1.32";
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
@ISA = qw(Exporter);
|
||||
@@ -47,6 +47,9 @@ sub new {
|
||||
$self->{NoMultiOptions} = 1;
|
||||
delete $conf{-AllowMultiOptions};
|
||||
}
|
||||
else {
|
||||
delete $conf{-AllowMultiOptions};
|
||||
}
|
||||
}
|
||||
if (exists $conf{-String} ) {
|
||||
if ($conf{-String}) {
|
||||
@@ -501,7 +504,7 @@ sub save {
|
||||
if ( (@two && $one) && ( (scalar @two) % 2 == 0) ) {
|
||||
# @two seems to be a hash
|
||||
my %h = @two;
|
||||
$this->Save($one, \%h);
|
||||
$this->save_file($one, \%h);
|
||||
}
|
||||
else {
|
||||
croak "The save() method is deprecated. Use the new save_file() method instead!";
|
||||
@@ -577,8 +580,17 @@ sub _store {
|
||||
foreach my $entry (sort keys %config) {
|
||||
if (ref($config{$entry}) eq "ARRAY") {
|
||||
foreach my $line (@{$config{$entry}}) {
|
||||
$line =~ s/#/\\#/g;
|
||||
$config_string .= $indent . $entry . " " . $line . "\n";
|
||||
# patch submitted by Peder Stray <peder@linpro.no> to catch
|
||||
# arrays of hashes.
|
||||
if (ref($line) eq "HASH") {
|
||||
$config_string .= $indent . "<" . $entry . ">\n";
|
||||
$config_string .= $this->_store($level + 1, %{$line});
|
||||
$config_string .= $indent . "</" . $entry . ">\n";
|
||||
}
|
||||
else {
|
||||
$line =~ s/#/\\#/g;
|
||||
$config_string .= $indent . $entry . " " . $line . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif (ref($config{$entry}) eq "HASH") {
|
||||
@@ -1425,7 +1437,7 @@ Thomas Linden <tom@daemon.de>
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.30
|
||||
1.32
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
Reference in New Issue
Block a user