Skip Menu |

This queue is for tickets about the Digest-CRC CPAN distribution.

Report information
The Basics
Id: 75206
Status: resolved
Priority: 0/
Queue: Digest-CRC

People
Owner: OLIMAUL [...] cpan.org
Requestors: garu [...] cpan.org
Cc:
AdminCc:

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



Subject: clone() not working properly
Hi there! Thank you so much for such a nice module - creating CRC digest was never this easy :) I'm having some trouble with the clone() method, though. It appears the cloned data comes with a bogus digest: --------------8<-------------- perl -MDigest::CRC -E 'my $original = Digest::CRC->new; $original->add( q[I can has Digest?] ); my $cloned = $original->clone; say q[original: ] . $original->hexdigest; say q[cloned: ] . $cloned->hexdigest' original: bb28461d cloned: ffffffff -------------->8-------------- I tried dumping them with Data::Printer and the only difference seems to be that the $self->{_tab} internal structure is missing from the cloned version. In fact, if I break encapsulation and copy it through, I get the expected result: --------------8<-------------- perl -MDigest::CRC -E 'my $original = Digest::CRC->new; $original->add( q[I can has Digest?] ); my $cloned = $original->clone; $cloned->{_tab} = [ @{$original->{_tab}} ]; say q[original: ] . $original->hexdigest; say q[cloned: ] . $cloned->hexdigest;' original: bb28461d cloned: bb28461d -------------->8-------------- I'm not writing a patch though, because I couldn't see the $self->{_tab} structure being created during neither the new() nor the add() method calls, so I'm not confident enough that simply copying it over isn't going to break anything. Thanks!
Hi, this clone() issue has been fixed in 0.19 which has been released today. Oliver