IO::Buffered::Regexp - Regular expression buffering


IO-Buffered documentation  | view source Contained in the IO-Buffered distribution.

Index


NAME

Top

IO::Buffered::Regexp - Regular expression buffering

DESCRIPTION

Top

SYNOPSIS

Top

METHODS

Top

new($regexp, MaxSize => 0..Inf, Double => 0|1, ReturnsLast => 0|1)

The IO::Buffered::Regexp buffer type takes a regular expression as input and splits records based on that. Only the match defined in the () is returned and not the complete match.

The options MaxSize and Double are optional.

MaxSize provides a limit on how big a buffer can grow, when the limit is hit an exception is thrown.

Double defines the how the regexp is used to extract new items and remove old data from the buffer. By default a while loop is used that grabs and removes one item at a time from the buffer. If Double is defined another method is used:

    my @records = ($self->{buffer} =~ /$regexp/g);
    $self->{buffer} =~ s/$regexp//g;

This might be faster in some cases and slower in others.

ReturnsLast sets what the returns_last() returns, this is used by the "Split" buffer type to return the correct value as it is just a wrapper.

flush($str, ...)
buffer()
write($str, ...)
read()
returns_last()
read_last()

AUTHOR

Top

Troels Liebe Bentsen <tlb@rapanden.dk>

COPYRIGHT

Top


IO-Buffered documentation  | view source Contained in the IO-Buffered distribution.