Enumeration of variables in current and higher frames

I am trying to debug a script with perl -d ... After I break down where I want, I would like to print the current environment and the environment from higher frames.

I see the stack through T Now, if I try V , I get a list of everything that is pretty much useless, since it includes things like SO_BROADCAST constants, etc. How can I filter them and get only local ones?

How do I do the same for higher frames?

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

+4
source share
2 answers

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

Provided that you mean "getting only local", of course.

+1
source

You can also use the PadWalker module to provide you with a list of lexical files in a given area. The peek_my and peek_our return a hashref of variables in scope in the relative frame of the call (0 - current frame, 1 - calling frame, ...)

+1
source

All Articles