Lintian::SlidingWindow(3)

Lintian::SlidingWindow3

Lintian interface to sliding window match

Usage

    use Lintian::SlidingWindow;
    my $sfd = Lintian::SlidingWindow->new('<','someevilfile.c', sub { $_ = lc($_); });
    my $window;
    while ($window = $sfd->readwindow) {
       if (index($window, 'evil') > -1) {
           if($window =~
                 m/software \s++ shall \s++
                   be \s++ used \s++ for \s++ good \s*+ ,?+ \s*+
                   not \s++ evil/xsim) {
              # do something like : tag 'license-problem-json-evil';
           }
       }
    }

Overview

Lintian::SlidingWindow provides a way of matching some pattern, including multi line pattern, without needing to fully load the file in memory.

Class methods

new(HANDLE[, BLOCKSUB[, BLOCKSIZE]])

Create a new sliding window by reading from a given HANDLE, which must be open for reading. Optionally run BLOCKSUB against each block. Note that BLOCKSUB should apply transform byte by byte and does not depend of context.

Each window consists of up to two blocks of BLOCKSIZE characters.

Instance methods

readwindow

Return a new block of sliding window. Return undef at end of file.

"blocksize"
blocknumber
handle
blocksub

Diagnostics

no data type specified

Releases

5 releases since Debian 9 (Stretch); the text changed 4 times.

  1. 9
  2. 10
  3. 11
  4. 12
  5. 13

Author

Originally written by Bastien ROUCARIES for Lintian.

From lintian 2.122.0 in Debian 13 (Trixie). Parsed by carta from the page's man source.