[Pdx-pm] Data::Dumper::Simple

Austin Schutz tex at off.org
Wed May 18 13:48:29 PDT 2005

On Wed, May 18, 2005 at 08:56:30AM -0700, Ovid wrote:
> --- Austin Schutz <tex at off.org> wrote: 
> > 	My Debug::Toolkit does something similar in a format I like 
> > (need to publish it one of these days soon), but I ran up against the
> > same thing, and the source filter thing scares me - at least, I
> > recall having
> > odd problems with it.
> > 	Surely there's another way of obtaining the variable name. Have
> > you ever looked in to trying to extract it from the interpreter's
> > data
> > structures?
> Maybe there's some obscure incantation in the B modules while mucking
> about with the padlist, but I don't really do much of that.  PadWalker
> might also get me what I want, but I realized I would have trouble
> matching the data that I fetch with the data that I have.  It seemed
> more trouble than it was worth.  DDS is really simple internally.
> Plus, why should a source filter scare you?  This is only a debugging
> module.  It's not intended for any sort of production use so there
> shouldn't be any exposure.

	I've had bad luck specifically with the cpp filter, though in
general I don't like it because it will fail at times when the filter
isn't properly matched. dump(")") and the like.
	Also like any sort of macro substitution, you can have odd results if
you don't properly parenthesize parameters. There's a good document explaining
problems that can cause around here somewhere, but I'm having trouble finding
it.  Also for multiline statements such as:


	line numbers may be altered by source filter substitutions. Maybe the
perl filter stuff is smart enough to account for that, but it can be a real
headache with C code.
	Often in practice the source filters don't recognize multiline
statements at all, though this may be the application of the filter and not
the fault of the filter itself.

	All that may seem fairly obscure, but when it bites you when you're
trying to debug code it can make the process more difficult.

	Also, for myself I like to keep it around in production for exception
handling - if an error occurs it can be nice to be able to dump the related
data structures. I also add a -debug parameter flag to much of my code, so the
debugging code is still in there even if it isn't executed.

	..that said, having the variable names is a real boon. It would seem
like that should be possible to get without having to walk the symbol table,
but maybe not.


More information about the Pdx-pm-list mailing list