1.30: - fixed typo, which made 1.29 unusable (undefined var %config)

- added code to check if unknown parameters to new()
	   has been supplied.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@18 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
Thomas von Dein
2009-10-10 16:15:02 +00:00
parent 5dabbe586a
commit 2ae16df3ad
3 changed files with 22 additions and 4 deletions

View File

@@ -1,3 +1,7 @@
1.30: - fixed typo, which made 1.29 unusable (undefined var %config)
- added code to check if unknown parameters to new()
has been supplied.
1.29: 1.29:
- added 2 procedural functions ParseConf and SaveConf - added 2 procedural functions ParseConf and SaveConf
- added new parameters -AutoTrue and -FlagBits - added new parameters -AutoTrue and -FlagBits

View File

@@ -18,7 +18,7 @@ use strict;
use Carp; use Carp;
use Exporter; use Exporter;
$Config::General::VERSION = "1.29"; $Config::General::VERSION = "1.30";
use vars qw(@ISA @EXPORT); use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter); @ISA = qw(Exporter);
@@ -41,35 +41,42 @@ sub new {
my %conf = @param; my %conf = @param;
$configfile = delete $conf{-file} if(exists $conf{-file}); $configfile = delete $conf{-file} if(exists $conf{-file});
$configfile = delete $conf{-hash} if(exists $conf{-hash}); $configfile = delete $conf{-hash} if(exists $conf{-hash});
if (exists $conf{-AllowMultiOptions} ) { if (exists $conf{-AllowMultiOptions} ) {
if ($conf{-AllowMultiOptions} =~ /^no$/) { if ($conf{-AllowMultiOptions} =~ /^no$/) {
$self->{NoMultiOptions} = 1; $self->{NoMultiOptions} = 1;
delete $conf{-AllowMultiOptions};
} }
} }
if (exists $conf{-String} ) { if (exists $conf{-String} ) {
if ($conf{-String}) { if ($conf{-String}) {
$self->{StringContent} = $conf{-String}; $self->{StringContent} = $conf{-String};
delete $conf{-String};
} }
} }
if (exists $conf{-LowerCaseNames}) { if (exists $conf{-LowerCaseNames}) {
if ($conf{-LowerCaseNames}) { if ($conf{-LowerCaseNames}) {
$self->{LowerCaseNames} = 1; $self->{LowerCaseNames} = 1;
delete $conf{-LowerCaseNames};
} }
} }
if (exists $conf{-IncludeRelative}) { if (exists $conf{-IncludeRelative}) {
if ($conf{-IncludeRelative}) { if ($conf{-IncludeRelative}) {
$self->{IncludeRelative} = 1; $self->{IncludeRelative} = 1;
delete $conf{-IncludeRelative};
} }
} }
# contributed by Thomas Klausner <domm@zsi.at> # contributed by Thomas Klausner <domm@zsi.at>
if (exists $conf{-UseApacheInclude}) { if (exists $conf{-UseApacheInclude}) {
if ($conf{-UseApacheInclude}) { if ($conf{-UseApacheInclude}) {
$self->{UseApacheInclude} = 1; $self->{UseApacheInclude} = 1;
delete $conf{-UseApacheInclude};
} }
} }
if (exists $conf{-MergeDuplicateBlocks}) { if (exists $conf{-MergeDuplicateBlocks}) {
if ($conf{-MergeDuplicateBlocks}) { if ($conf{-MergeDuplicateBlocks}) {
$self->{MergeDuplicateBlocks} = 1; $self->{MergeDuplicateBlocks} = 1;
delete $conf{-MergeDuplicateBlocks};
} }
} }
if (exists $conf{-AutoTrue}) { if (exists $conf{-AutoTrue}) {
@@ -79,14 +86,21 @@ sub new {
true => '^(on|yes|true|1)$', true => '^(on|yes|true|1)$',
false => '^(off|no|false|0)$', false => '^(off|no|false|0)$',
}; };
delete $conf{-AutoTrue};
} }
} }
if (exists $conf{-FlagBits}) { if (exists $conf{-FlagBits}) {
if ($conf{-FlagBits} && ref($conf{-FlagBits}) eq "HASH") { if ($conf{-FlagBits} && ref($conf{-FlagBits}) eq "HASH") {
$self->{FlagBits} = 1; $self->{FlagBits} = 1;
$self->{FlagBitsFlags} = $conf{-FlagBits}; $self->{FlagBitsFlags} = $conf{-FlagBits};
delete $conf{-FlagBits};
} }
} }
if (%conf) {
croak "Unknown parameter(s): " . (join ", ", (keys %conf) ) . "\n";
}
} }
elsif ($#param == 0) { elsif ($#param == 0) {
# use of the old style # use of the old style
@@ -544,7 +558,7 @@ sub save_string {
} }
} }
else { else {
return $this->_store(0,%config); return $this->_store(0, %{$config});
} }
} }
@@ -1411,7 +1425,7 @@ Thomas Linden <tom@daemon.de>
=head1 VERSION =head1 VERSION
1.29 1.30
=cut =cut

2
README
View File

@@ -59,4 +59,4 @@ AUTHOR
VERSION VERSION
1.29 1.30