Skip Menu |

This queue is for tickets about the Clone CPAN distribution.

Report information
The Basics
Id: 117161
Status: open
Priority: 0/
Queue: Clone

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 0.36
  • 0.38
Fixed in: (no value)



Subject: Can't clone Math::BigInt::GMP objects
Math::BigInt::GMP objects cannot be cloned with Clone.pm: $ perl5.18.4 -MMath::BigInt=only,GMP -MClone=clone -E 'say clone(Math::BigInt->new(42))->bstr' failed to fetch mpz pointer at /opt/perl-5.18.4/lib/site_perl/5.18.4/Math/BigInt.pm line 3347. Storable can deal with it: $ perl5.18.4 -MMath::BigInt=only,GMP -MStorable=dclone -E 'say dclone(Math::BigInt->new(42))->bstr' 42 However, Storable cannot handle some types Clone can handle (most notably, Regexp). A solution could be to invent a hook mechanism just as in Storable (STORABLE_freeze and STORABLE_thaw), or even better, re-use the Storable hooks if they are available. A more simpler solution would be to just document this limitation, and point to other clone modules which may handle this (i.e. Storable). In this special situation it would be possible to fallback to the pure perl Math::BigInt implementation (using "use Math::BigInt only => 'Calc'"), but this would be a huge performance hit when doing real calculations.
Ticket migrated to github as https://github.com/garu/Clone/issues/16