Mojo::Buffer(3p)

NAME
Mojo::Buffer - A Simple In-Memory Buffer

SYNOPSIS
    use Mojo::Buffer;

    my $buffer = Mojo::Buffer->new('foo');
    $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.

  "length"
    my $length = $buffer->length;

  "raw_length"
    my $raw_length = $buffer->raw_length;

METHODS
Mojo::Buffer inherits all methods from Mojo::Base and implements the following new ones.

  "new"
    my $buffer = Mojo::Buffer->new;
    my $buffer = Mojo::Buffer->new('foobarbaz');

  "add_chunk"
    $buffer = $buffer->add_chunk('foo');

  "empty"
    my $string = $buffer->empty;

  "get_line"
   my $line = $buffer->get_line;

  "remove"
    my $string = $buffer->remove(4);

  "to_string"
    my $string = $buffer->to_string;
    my $string = "$buffer";