SYNOPSIS
package MyPackage;
use Moo;
with 'Catmandu::Buffer';
# Print only when the buffer is full...
sub print {
my ($self,$str) = @_;
if ($self->buffer_is_full) {
print join "\n" , @{ $self->buffer };
$self->clear_buffer;
}
$self->buffer_add($str);
}
package main;
my $x = MyPackage->new;
for (my $i = 0 ; $i < 1000 ; $i++) {
$x->print($x);
}