Skip Menu |

This queue is for tickets about the Config-General CPAN distribution.

Report information
The Basics
Id: 41748
Status: resolved
Priority: 0/
Queue: Config-General

People
Owner: tlinden [...] cpan.org
Requestors: terje [...] hacker.no
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: bug-Config-General [...] rt.cpan.org
Subject: Config::General semi-bug
Date: Tue, 16 Dec 2008 12:00:55 +0100 (CET)
To: tlinden [...] cpan.org
From: terje [...] hacker.no
Hello, I would like to call your attention to a bug regarding data ties. In short, ties are not considered when saving configuration to file in Config::General::_store(), since the tied hash is discarded with a my (.., %config) = @_; The bug is described - with example code and a fine conclusion by user bart - in this thread at PerlMonks: http://www.perlmonks.org/?node_id=730433 If I manage to hack it together, I will send a patch. Best, Terje
Hi, bug acknowledged. I'll fix it during the next days. Sorry for the problems it may have caused. Btw - I have modified the changes of your patch. First, there are several references like this in your patch: \%{$config}, in such cases using just $config will achieve the same. I did not use the $$config{$blah} notation but instead $config->{blah}, in this case it is easier to identify it as referenced hash entry. And, last, the $entry variables don't have to be referenced (you used $$entry) because they are alredy references. So, finally the patch now looks like: 1107c1107 < $config_string = $this->_store(0, %{$this->{config}}); --- Show quoted text
> $config_string = $this->_store(0, $this->{config});
1114c1114 < $config_string = $this->_store(0,%{$config}); --- Show quoted text
> $config_string = $this->_store(0, $config);
1140c1140 < return $this->_store(0, %{$this->{config}}); --- Show quoted text
> return $this->_store(0, $this->{config});
1147c1147 < return $this->_store(0, %{$config}); --- Show quoted text
> return $this->_store(0, $config);
1158c1158 < my($this, $level, %config) = @_; --- Show quoted text
> my($this, $level, $config) = @_;
1169,1171c1169,1171 < foreach my $entry (sort keys %config) { < if (ref($config{$entry}) eq 'ARRAY') { < foreach my $line (sort @{$config{$entry}}) { --- Show quoted text
> foreach my $entry (sort keys %{$config}) { > if (ref($config->{$entry}) eq 'ARRAY') { > foreach my $line (sort @{$config->{$entry}}) {
1180,1181c1180,1181 < elsif (ref($config{$entry}) eq 'HASH') { < $config_string .= $this->_write_hash($level, $entry, $config{$entry}); --- Show quoted text
> elsif (ref($config->{$entry}) eq 'HASH') { > $config_string .= $this->_write_hash($level, $entry,
$config->{$entry}); 1184c1184 < $config_string .= $this->_write_scalar($level, $entry, $config{$entry}); --- Show quoted text
> $config_string .= $this->_write_scalar($level, $entry,
$config->{$entry}); 1189,1191c1189,1191 < foreach my $entry (keys %config) { < if (ref($config{$entry}) eq 'ARRAY') { < foreach my $line (@{$config{$entry}}) { --- Show quoted text
> foreach my $entry (keys %{$config}) { > if (ref($config->{$entry}) eq 'ARRAY') { > foreach my $line (@{$config->{$entry}}) {
1200,1201c1200,1201 < elsif (ref($config{$entry}) eq 'HASH') { < $config_string .= $this->_write_hash($level, $entry, $config{$entry}); --- Show quoted text
> elsif (ref($config->{$entry}) eq 'HASH') { > $config_string .= $this->_write_hash($level, $entry,
$config->{$entry}); 1204c1204 < $config_string .= $this->_write_scalar($level, $entry, $config{$entry}); --- Show quoted text
> $config_string .= $this->_write_scalar($level, $entry,
$config->{$entry}); 1269c1269 < $config_string .= $this->_store($level + 1, %{$line}); --- Show quoted text
> $config_string .= $this->_store($level + 1, $line);
regards, Tom
fixed in 2.41
Subject: Re: [rt.cpan.org #41748] Config::General semi-bug
Date: Wed, 17 Dec 2008 20:33:14 +0100 (CET)
To: bug-Config-General [...] rt.cpan.org
From: terje [...] hacker.no
Tom, Your module has worked perfectly for me in every scenario I used it. Rest assured, this does not qualify for 'trouble'. I tried to point out the poor quality, it was done under time pressure with no understanding of your code. \%{}, $$ is easier to recognize and revert during experiments. In retrospect; I should have cleaned it up or not sent it. My apologies. Thanks again for great module and bugfix. Have a merry christmas! :-) Best, Terje
done