Display
Perl’s debugger has several commands for examining data structures while your program is stopped at a breakpoint.
ppEXPRThis command is the same as
print DB::OUTEXPRin the current package. In particular, since this is just Perl’s ownprintfunction, nested data structures and objects are not shown—use thexcommand for that. TheDB::OUThandle prints to your terminal (or perhaps an editor window) no matter where standard output may have been redirected.xxEXPRThe
xcommand evaluates its expression in list context and displays the result, pretty printed. That is, nested data structures are printed out recursively and with unviewable characters suitably encoded.VVPKGVPKG VARSThis command displays all (or when you specify
VARS, some) variables in the specifiedPKG(defaulting to themainpackage) using a pretty printer. Hashes show their keys and values, control characters are rendered legibly, nested data structures print out in a legible fashion, and so on. This is similar to calling thexcommand on each applicable variable, except thatxworks with lexical variables, too. Also, here you type the identifiers without a type specifier such as$or@, like this:V Pet::Camel SPOT FIDOIn place of a variable name in
VARS, you can use~PATTERNor!PATTERNto print existing variables whose names either match or don’t match the specified pattern.XXVARSThis command is the same as
VCURRENTPACKAGE, whereCURRENTPACKAGEis the package into which the current line was compiled.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access