Hmm, this doesn't work for me. If I manually change DH.pm to use Math::BigInt lib => "GMP"; and then make the changes to my script as per your suggestion, my execution time drastically increases (from 5 to 25 seconds) until I revert the change to DH.pm.
If you've got both Math::BigInt::GMP and Math::BigInt::Pari installed,
you've effectively loaded both of them,
and DH.pm is using Math::BigInt::Pari since it was loaded last :)