NAME
Mojo::Buffer - A Simple In-Memory Buffer
SYNOPSIS
use Mojo::Buffer;
my $buffer = Mojo::Buffer->new;
$buffer->add_chunk('bar');
my $foo = $buffer->remove(3);
my $bar = $buffer->empty;
DESCRIPTION
Mojo::Buffer is a simple in-memory buffer.
ATTRIBUTES
Mojo::Buffer implements the following attributes.
raw_length
my $length = $buffer->raw_length;
$buffer = $buffer->raw_length(23);
METHODS
Mojo::Buffer inherits all methods from Mojo::Base and implements the following new ones.
add_chunk
$buffer = $buffer->add_chunk('foo');
contains
my $position = $buffer->contains('something');
empty
my $chunk = $buffer->empty;
get_line
my $line = $buffer->get_line;
length
my $length = $buffer->length;
remove
my $chunk = $buffer->remove(4);
my $chunk = $buffer->remove(4, 'abcd');
to_string
my $string = $buffer->to_string;
my $string = "$buffer";