/usr/share/perl5/App/Alice/MessageStore/Memory.pm is in alice 0.19-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | package App::Alice::MessageStore::Memory;
use Any::Moose;
has msgbuffer => (
is => 'rw',
isa => 'ArrayRef',
default => sub {[]}
);
has buffersize => (
is => 'ro',
default => 100
);
sub add {
my ($self, $message) = @_;
push @{$self->msgbuffer}, $message;
if (@{$self->msgbuffer} > $self->buffersize) {
shift @{$self->msgbuffer};
}
}
sub clear {
my $self = shift;
$self->msgbuffer([]);
}
sub with_messages {
my ($self, $cb, $start, $complete_cb) = @_;
$cb->(@{ $self->msgbuffer });
$complete_cb->() if $complete_cb;
}
__PACKAGE__->meta->make_immutable;
1;
|