Skip to content

Commit 68b0415

Browse files
committed
Merge.pm: fix RT#69872 - Cloning does not happen
Fix for not dereferencing in a hash with depth greater 1 when using Clone or Clone::PP. Without passing the depth of the hashes (which was simply wrong anyway) the results are the same as if using Storable::dclone. Reported by John Busco. Signed-off-by: Stefan Hermes <sh@riseup.net>
1 parent 12dd904 commit 68b0415

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Hash/Merge.pm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ sub merge {
190190
: 'SCALAR';
191191

192192
if ( $self->{'clone'} ) {
193-
$left = _my_clone( $left, 1 );
194-
$right = _my_clone( $right, 1 );
193+
$left = _my_clone( $left );
194+
$right = _my_clone( $right );
195195
}
196196

197197
local $context = $self;
@@ -269,7 +269,7 @@ sub _hashify {
269269

270270
sub _my_clone {
271271
my $self = &_get_obj; # '&' + no args modifies current @_
272-
my ( $arg, $depth ) = @_;
272+
my ( $arg ) = @_;
273273

274274
if ( $self->{clone} && !$clone ) {
275275
if ( eval { require Clone; 1 } ) {
@@ -280,7 +280,7 @@ sub _my_clone {
280280
my $var = shift; # Forced clone
281281
return $var;
282282
}
283-
Clone::clone( shift, $depth );
283+
Clone::clone( shift );
284284
};
285285
}
286286
elsif ( eval { require Storable; 1 } ) {
@@ -294,7 +294,7 @@ sub _my_clone {
294294
$clone = sub {
295295
my $var = shift; # Forced clone
296296
return $var if !ref($var);
297-
Clone::PP::clone( $var, $depth );
297+
Clone::PP::clone( $var );
298298
};
299299
}
300300
else {

0 commit comments

Comments
 (0)