Mojo::Buffer - A Simple In-Memory Buffer
use Mojo::Buffer; my $buffer = Mojo::Buffer->new; $buffer->add_chunk('bar'); my $foo = $buffer->remove(3); my $bar = $buffer->empty;
Mojo::Buffer is a simple in-memory buffer.
Mojo::Buffer implements the following attributes.
raw_size
my $size = $buffer->raw_size; $buffer = $buffer->raw_size(23);
Mojo::Buffer inherits all methods from Mojo::Base and implements the following new ones.
new
my $buffer = Mojo::Buffer->new;
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;
remove
my $chunk = $buffer->remove(4); my $chunk = $buffer->remove(4, 'abcd');
size
my $size = $buffer->size;
to_string
my $string = $buffer->to_string; my $string = "$buffer";
To install Mojo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo
CPAN shell
perl -MCPAN -e shell install Mojo
For more information on module installation, please visit the detailed CPAN module installation guide.