in reply to Re^4: Dumping opaque objects
in thread Dumping opaque objects

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

Replies are listed 'Best First'.
Re^6: Dumping opaque objects
by hv (Prior) on Jan 25, 2022 at 13:58 UTC

    Thanks Rob, I am indeed pretty conversant with that stuff. The aim here is to avoid writing my own dumping module just to get around the lack of a single feature in the standard one - there is a forest of them already on CPAN, it seems very likely there would already be one ideal for my needs (or needing at most minor topiary).

    See also my update on the root post where I describe what I'm currently experimenting with via Data::Printer: that is working at least well enough to let me get further with the code I was originally trying to write.