On 5/13/07, Peter Gordon <[EMAIL PROTECTED]> wrote: > On this occasion, one of the elements is a string a few megabytes long, > and I don't really want to dump the whole string. > > What would be the nicest way to suppress printing of this particular > element. > > I could print each element in turn, but that is inelegant.
I'm afraid I don't have an elegant solution to offer. (A related problem that does have debugger support is deeply recursive structures. Saying "x 3 $that" limits to depth 3 print.) What you might do -- and I'm not saying this is significantly different from printing each element in turn -- is add a to_debug method to the object. This copies the object but only leaves a digest version of the long string, say with the first 100 characters. Not that I've searched CPAN for prior art, but you might want to make this into a reusable module. (With Moose.pm or Perl 6, it would more properly be a Role.) Something like: package MyModuleWithLongMember; use Debug::Dump::Digest qw(long_memb1 huge_memb2); And then in the debugger: x $self->to_debug; -- Gaal Yahas <[EMAIL PROTECTED]> http://gaal.livejournal.com/ _______________________________________________ Perl mailing list [email protected] http://perl.org.il/mailman/listinfo/perl
