> or print variables named via regex.

The following commands dump variables by regex

DB<162> h X X [vars] Same as "V currentpackage [vars]". DB<163> h V V [pkg [vars]] List some (default all) variables in package (defaul +t current). Use ~pattern and !pattern for positive and negative regexps. DB<164> h y y [n [Vars]] List lexicals in higher scope <n>. Vars same as V.

With "{" you can tell the debugger to automatically execute these (and other debugger) commands with each prompt, like when single stepping or when running into a breakpoint.

DB<1> h { { db_command Define debugger command to run before each prompt. { ? List debugger commands to run before each prompt. {{ db_command Add to the list of debugger commands to run before ea +ch prompt. { * Delete the list of debugger commands to run before eac +h prompt.

The following example

c = continue runs into the breakpoint s = single step shows the dumping

DB<239> b 11 $a==3 DB<240> L d:/Users/RolfLangsdorf/AppData/Roaming/pm/tst_debuger.pl: 11: $a++; break if ($a==3) DB<240> { X y DB<241> { pre-debugger commands: { -- X y DB<241> c 0123auto(-1) DB<241> X y $y = 3 DB<242> s auto(-1) DB<242> X y $y = 3 DB<243> s auto(-1) DB<243> X y $y = 4 DB<244> c 45678910auto(-1) DB<244> X y DB<245>

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!


In reply to Re: How can I print variable contents from the debugger non-interactively? ( { = auto cmd ; X V y = dump by regex) by LanX
in thread How can I print variable contents from the debugger non-interactively? by davehorner

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.