Not only do I not know how it works, but I also don't even know what it does !!
My reading of that code is that it uses magic mostly to store the pointer to mpz in mg->mg_ptr. perlguts says its okay: "Extensions can use "PERL_MAGIC_ext" magic to 'attach' private information to variables (typically objects). This is especially useful because there is no way for normal perl code to corrupt this private information (unlike using extra elements of a hash object)". Then there is also that copying function dup_gmp_mpz, apparently for use with ithreads.
But I'm initially loathe to take that action as I don't know what risks it might create.
As far as I can tell, the risk is that something else will attach magic (with tag PERL_MAGIC_ext) to your Math::BigInt::GMP variable, and then you'll get wrong mg->mg_ptr. How likely is that? Probably pretty unlikely...
| [reply] [d/l] [select] |