in reply to Dumping opaque objects
Since further down in the thread you seem to say that other modules would be acceptable: I use Data::Dump::Filtered for these kind of things. Since in this case Math::GMP deals with integers, I think it's probably safe to not worry about escaping the stringified objects, but in theory one could use the pp function for escaping values as well.
use warnings; use strict; use Math::GMP; use Data::Dump qw/dd pp/; use Data::Dump::Filtered qw/add_dump_filter/; add_dump_filter( sub { my ($ctx, $objref) = @_; return { dump => "Math::GMP->new(\"$objref\")" } if $ctx->object_isa('Math::GMP'); return; # normal dumping } ); dd( Math::GMP->new("123"), Math::GMP->new("546745634563453111035453452346") ); __END__ ( Math::GMP->new("123"), Math::GMP->new("546745634563453111035453452346"), )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dumping opaque objects
by Fletch (Bishop) on Jan 24, 2022 at 20:24 UTC | |
|
Re^2: Dumping opaque objects
by hv (Prior) on Jan 24, 2022 at 19:02 UTC |