Taming the printing of @_
Do it in stages. Avoid 'x' as long as you need to if there's a possibility of an enormous data structure:
<DB> p "@_"
ARRAY(0x38234) Big::Nested::Mess=HASH(0x382437)
<DB> x keys %{ $_[1] }
...just the keys, so you can see what to look for...
When I was doing this a lot, I defined a p() subroutine that made a recursive copy of complex data structures, only the copy was something much more readable. This is assuming that the big nasty data structure is your own, and you have some application-specific notion of what would be more or less interesting to see in the output.
sub p {
my $x = shift;
if (! ref $x) {
return $x;
} elsif (ref($x) eq 'My::Class') {
return bless { name => $x->{name},
manager => $x->{manager}->getId(),
children => p($x->{children}),
# add any other fields you want to see
}, ref($x);
} elsif (UNIVERSAL::isa($x, 'ARRAY')) {
return [ map { p($_) } @$x ];
} elsif (UNIVERSAL::isa($x, 'HASH')) {
return { map { $_ => p($x->{$_}) } keys %$x };
} else {
return $x;
}
}
...tailored to your specific situation. (Actually, I think I also did a UNIVERSAL::can($x, 'p') to see if the object implemented its own readable-conversion method.)
Then you can do 'x p($whatever)' and get your customized dump. (You can take this farther, and pass in a "brevity level" parameter that starts out zero to display everything, but increases as you get into further nested things so that they will display as one-line summaries rather than structural dumps.)