Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks!
I'm developing a web app, using Data::Dumper to write a kind of crash dump into the error log file. Unfortunately, the output becomes quite large, as one of the dumped variables contains lots of other objects. The internals of several of those objects (mostly not my code) are not interesting for the crash dump. Instead, I would like to see those objects stringified, while the other object (my stuff) should be dumped normally.
Some of the classes are:
It seems I would need a hook into Data::Dumper that is called when Data::Dumper attempts to dump a blessed reference. It would decide if the reference is dumped as usual or if the reference is stringified.
Something like
print Data::Dumper->new([$mystuff],['mystuff'])->objectFilter(sub { my $obj=shift; return "$obj" if (ref($obj) eq 'Math::BigInt') or $obj->isa('Rose::D +B::Object::Metadata'); return $obj; })->Dump();
Any hints how to realize this?
Thanks,
Tux2000
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Data::Dumper too noisy
by kyle (Abbot) on Dec 02, 2008 at 17:58 UTC | |
|
Re: Data::Dumper too noisy
by samwyse (Scribe) on Dec 03, 2008 at 03:14 UTC |