You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Migrated from rt.cpan.org#117161 (status was 'new')
Requestors:
From srezic@cpan.org on 2016-08-23 13:16:25:
The text was updated successfully, but these errors were encountered: