The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Synopsis:

list[>] location [number]

List Perl source code.

Without arguments, prints lines centered around the current line. If this is the first list command issued since the debugger command loop was entered, then the current line is the current frame. If a subsequent list command was issued with no intervening frame changing, then that is start the line after we last one previously shown.

If the command has a '>' suffix, then line centering is disabled and listing begins at the specificed location.

The number of lines to show is controlled by the debugger "listsize" setting. Use set max list or show max list to see or set the value.

If the location form is used with a subsequent parameter, the parameter is the starting line number. When there two numbers are given, the last number value is treated as a stopping line unless it is less than the start line, in which case it is taken to mean the number of lines to list instead.

Examples:

 list 5            # List centered around line 5
 list foo.pl:5     # List foo.pl at line 5
 list , 16         # list lines ending in line 16
 list .            # List lines centered from where we currently are stopped
 list . 3          # List 3 lines starting from where we currently are stopped
                     # if . > 3. Otherwise we list from . to 3.
 list -            # List lines previous to those just shown

The output of the list command give a line number, and some status information about the line and the text of the line. Here is some hypothetical list output modeled roughly around line 251 of one version of this code:

  251             cmd.proc.frame_setup(tf)
  252  ->         brkpt_cmd.run(['break'])
  253 B01         line = __LINE__
  254 b02         cmd.run(['list', __LINE__.to_s])
  255 t03         puts '--' * 10

Line 251 has nothing special about it. Line 252 is where we are currently stopped. On line 253 there is a breakpoint 1 which is enabled, while at line 255 there is an breakpoint 2 which is disabled.

See also:

set autolist, help syntax location, disassemble, and deparse.