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"), )
In reply to Re: Dumping opaque objects
by haukex
in thread Dumping opaque objects
by hv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |