++ and thanks for the additional details, QM. It sounds like Data::Dump (and Data::Dump::Filtered) will do what you want, if you give it a bit of help. Here's a documented example that should get you going:

Full example source

#!/usr/bin/env perl use 5.012; use warnings; use Data::Dump qw/dump dumpf/; # This simulates the "resource" key you mentioned in (3) my $singleton = bless({ note => 'Defined outside $hairy_object', 1..20 # To really drive the point home :-) }, 'Singleton::Resource'); # A reasonably complex object, just enough to illustrate. my $hairy_object = bless { attr1 => 'val1', resource => $singleton, unwanted => bless({ thing => 'We want to ignore' }, 'Unwanted'), however => { this => { unwanted => bless({ is => 'actually wanted' }, 'Unwanted'), }}, Silly => { complex => { references => 'can be mangled', so => "they make more sense.", } } }, 'Hairy::Object'; # Throw in a couple of circular references $hairy_object->{circular_ref} = $hairy_object; $hairy_object->{internal_ref} = $hairy_object->{however}{this}; say "Before:"; say '-' x 76; say dump($hairy_object); say "\nAfter:"; say '-' x 76; $Data::Dump::INDENT = ' '; # Edit to taste. '| ' is nice, too. # Set up callback; called for every node in the $hairy_object tree # This is the heart of the logic that controls the dumpf() output my $dump = dumpf($hairy_object, sub { no warnings 'uninitialized'; my ($ctx, $obj) = @_; my %r; if ($ctx->depth == 0) { $r{hide_keys} = [ grep { ref($obj->{$_}) =~ /^(Unwanted|Something::Else)$/; } keys %$obj ]; }); # Munge the resulting dump a bit to remove extraneous bits $dump =~ s/^\Q$Data::Dump::INDENT\E//mg; # Remove one indent $dump =~ s/\Ado \{.+?my \$a = bless\(\{\n//s; $dump =~ s/\$a;\n\}//ms; say "\$a = bless( {\n$dump";

Output:

Before: ---------------------------------------------------------------------- +------ do { my $a = bless({ attr1 => "val1", circular_ref => 'fix', however => { this => { unwanted => bless({ is => "actually wa +nted" }, "Unwanted") }, }, internal_ref => 'fix', resource => bless({ 1 => 2, 11 => 12, 13 => 14, 15 => 16, 17 => 18, 19 => 20, 3 => 4, 5 => 6, 7 => 8, 9 => 10, note => "Defined outside \$hairy_object", }, "Singleton::Resource"), Silly => { complex => { references => "can be mangled", so +=> "they make more sense." }, }, unwanted => bless({ thing => "We want to ignore" }, "Unwanted" +), }, "Hairy::Object"); $a->{circular_ref} = $a; $a->{internal_ref} = $a->{however}{this}; $a; } After: ---------------------------------------------------------------------- +------ $a = bless( { attr1 => "val1", circular_ref => 'fix', however => # Here, there be dragons { this => { unwanted => bless({ is => "actually wanted" }, "Unwant +ed") }, }, internal_ref => 'fix', resource => $singleton, Silly => "references can be mangled so they make more sense.", }, "Hairy::Object"); $a->{circular_ref} = $a; $a->{internal_ref} = $a->{however}{this};

In reply to Re^3: Object Browser for Perl? by rjt
in thread Object Browser for Perl? by QM

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.