++ed by:
HIDEAKIO NGLENN ZMUGHAL GARU THALJEF

6 PAUSE user(s)
7 non-PAUSE user(s).

Rocky Bernstein

NAME DB::LineCache

DB::LineCache - package to read and cache lines of a Perl program.

SYNOPSIS

The LineCache package allows one to get any line from any file, caching lines of the file on first access to the file. Although the file may be any file, the common use is when the file is a Perl script since parsing of the file is done to figure out where the statement boundaries are.

The routines here may be is useful when a small random sets of lines are read from a single file, in particular in a debugger to show source lines.

  use DB::LineCache;
  $lines = DB::LineCache::getlines('/tmp/myperl.pl')
  # The following lines have same effect as the above.
  $: << '/tmp'
  Dir.chdir('/tmp') {$lines = DB::LineCache::getlines('myperl.pl')

  $line = DB::LineCache::getline('/tmp/myperl.pl', 6)
  # Note lines[6] == line (if /tmp/myperl.pl has 6 lines)

  DB::LineCache::clear_file_cache
  DB::LineCache::update_cache   # Check for modifications of all cached files.