Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the ConfigReader-Simple CPAN distribution.

Report information
The Basics
Id: 14296
Status: resolved
Priority: 0/
Queue: ConfigReader-Simple

People
Owner: bdfoy [...] cpan.org
Requestors: chris+rt [...] chrisdolan.net
Cc:
AdminCc:

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



Subject: clone method shares arrayrefs with original
The clone() method copies references to the filename and validkeys arrays rather than copying the data of the arrays. This means that this sequence is broken: $config = ConfigReader::Simple->new("configrc", [qw(Foo Bar Baz Quux)]); $clone = $config->clone(); $config->add_config_file("foorc"); because "foorc" gets added to the filename list for both instances.
From: cdolan [...] cpan.org
Here's a first cut at an improved clone() method that copies by value: sub clone { my $self = shift; my $clone = { filename => [@{$self->{filename}}], validkeys => [@{$self->{validkeys}}], config_data => {%{$self->{config_data}}}, }; bless $clone, __PACKAGE__; return $clone; }
This was fixed quite a while ago but I never closed the ticket. It's certainly fixed in 1.24.