views:

55

answers:

2

Hi, I'm trying to debug a script with perl -d .... After I break where I want, I'd like to print out the current environment and the environment from higher frames.

I see the stack via T. Now, if I try V, I get a list of everything, which is pretty much useless, since it includes stuff like SO_BROADCAST constants, etc. How can I filter those out and get only local ones?

How do I do the same for higher frames?

Also, how do I print the code around the line of a higher stack frame? v / l do only the current one.

+1  A: 

Have you tried y [level], which shows the lexical (my) variables at the current or higher (specified by level)?

Provided that's what you mean by "getting only local ones", of course.

Grrrr
But what is `level`? Is it the same as stack frame number? Which way are they numbered?
viraptor
By analogy with the caller() interface, 0 = current frame, 1 = the one above, etc.
Grrrr
+1  A: 

You can also use the PadWalker module to give you a list of lexicals at a given scope. The peek_my and peek_our functions return a hashref of the variables in scope at a relative call frame (0 - current frame, 1 - calling frame, ...)

Eric Strom