IO::Buffered::Split - Split based buffering


IO-Buffered documentation Contained in the IO-Buffered distribution.

Index


Code Index:

NAME

Top

IO::Buffered::Split - Split based buffering

DESCRIPTION

Top

SYNOPSIS

Top

METHODS

Top

new()

AUTHOR

Top

Troels Liebe Bentsen <tlb@rapanden.dk>

COPYRIGHT

Top


IO-Buffered documentation Contained in the IO-Buffered distribution.
package IO::Buffered::Split; 
use strict;
use warnings;
use Carp;

use base ("IO::Buffered");

use IO::Buffered::Regexp;

# FIXME: Write documentation

our $VERSION = '1.00';

use base "Exporter";

our @EXPORT_OK = qw();

sub new {
    my ($class, $regexp, %opts) = @_;
    
    # Check that $regexp is a Regexp or a non empty string
    croak "Split should be a string or regexp" if !(defined $regexp and 
            (ref $regexp eq 'Regexp' or (ref $regexp eq '' and $regexp ne '')));
    
    return new IO::Buffered::Regexp(qr/(.*?)$regexp/, %opts, ReturnsLast => 0); 
}

1;