I also want to distinguish between GMP objects and simple integers

Yes - inside my own gmp-based modules I often want to know about such things.
I normally use XS or Inline::C subroutines for this.

In pure perl code, as you may already be well aware, the ref() function will go a long way to providing useful information about references and module objects.
use warnings; use Math::BigInt; use Math::GMP; my $v = 9; my %h = (foo => $v); for (\%h, [$v], \$v, Math::GMP->new($v), Math::BigInt->new($v), $v) { ref($_) ? print ref($_), "\n" : print "Not a reference\n"; } __END__ Outputs: HASH ARRAY SCALAR Math::GMP Math::BigInt not a reference
You can also use the B module instead of XS/Inline::C to determine whether a scalar is an IV or an NV or a PV or a combination thereof.

If you want more info on any of these aspects, just ask.
(I don't want to annoy you by banging on with stuff that you already know (or stuff that you're not particularly interested in).

Cheers,
Rob

In reply to Re^5: Dumping opaque objects by syphilis
in thread Dumping opaque objects by hv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.