mirror of
https://codeberg.org/scip/Config-General.git
synced 2025-12-16 20:21:01 +01:00
1.36 - simplified new() parameter parsing, should be now a little
bit better to understand. - added new parameter -DefaultConfig, which can hold a hashref or a string, which will be used to pre-define values of the resulting hash after parsing a config. Thanks to Mark Hampton <mark.hampton@qualis.com> for the suggestion. - added new parameter -MergeDuplicateOptions, which allows one to overwrite duplicate options, which is required, if you turn on -DefaultConfig, because otherwise a array would be created, which is probably not what you wanted. - added patch by Danial Pearce <danial@infoxchange.net.au> to Config::General::Extended::keys(), which allows to retrieve the keys of the object itself (which was not directly possible before) - added patch by Danial Pearce <danial@infoxchange.net.au> to Config::General::Extended::value(), which allows to set a value to a (perlish-) nontrue value. This was a bug. - added patch by Danial Pearce <danial@infoxchange.net.au> to Config::General::_parse_value, which fixes a bug in this method, which in prior versions caused values of "0" (zero digit) to be wiped out of the config. - added tests in t/run.t for the new default config feature. git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@25 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
@@ -22,7 +22,7 @@ use vars qw(@ISA);
|
||||
use strict;
|
||||
|
||||
|
||||
$Config::General::Extended::VERSION = "1.4";
|
||||
$Config::General::Extended::VERSION = "1.5";
|
||||
|
||||
|
||||
sub obj {
|
||||
@@ -52,7 +52,7 @@ sub value {
|
||||
# this can be a hashref or a scalar
|
||||
#
|
||||
my($this, $key, $value) = @_;
|
||||
if ($value) {
|
||||
if (defined $value) {
|
||||
$this->{config}->{$key} = $value;
|
||||
}
|
||||
else {
|
||||
@@ -157,6 +157,9 @@ sub keys {
|
||||
if (exists $this->{config}->{$key} && ref($this->{config}->{$key}) eq "HASH") {
|
||||
return map { $_ } keys %{$this->{config}->{$key}};
|
||||
}
|
||||
elsif (!$key) {
|
||||
return map { $_ } keys %{$this->{config}};
|
||||
}
|
||||
else {
|
||||
return ();
|
||||
}
|
||||
@@ -451,6 +454,8 @@ config above you yould do that:
|
||||
print Dumper($conf->keys("individual");
|
||||
$VAR1 = [ "martin", "joseph" ];
|
||||
|
||||
If no key name was supplied, then the keys of the object itself will be returned.
|
||||
|
||||
You can use this method in B<foreach> loops as seen in an example above(obj() ).
|
||||
|
||||
|
||||
@@ -517,7 +522,7 @@ Thomas Linden <tom@daemon.de>
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.4
|
||||
1.5
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
Reference in New Issue
Block a user