se IRC::Formatting::HTML qw/html_to_irc/;
use App::Alice::Stream;
use App::Alice::Commands;
use JSON;
use Encode;
use utf8;
use Any::Moose;
use Try::Tiny;
has 'app' => (
is => 'ro',
isa => 'Ap
ender('range', $after, 'after');
my $res = $req->new_response(200);
$res->body(to_json [$before, $after]);
$respond->($res->finalize);
}
);
}
}
sub send_config {
f->app->render('server_listitem', $name);
my $res = $req->new_response(200);
$res->body(to_json({config => $config, listitem => $listitem}));
$res->header("Cache-control" => "no-cache");
re
package App::Alice::MessageStore::Redis;
use Any::Moose;
use AnyEvent::Redis;
use JSON;
my $redis = AnyEvent::Redis->new;
has id => (
is => 'ro',
required => 1
);
has buffersize => (
is => '
ub add {
my ($self, $message) = @_;
return unless $message;
$redis->rpush($self->id, encode_json $message);
$redis->llen($self->id, sub {
$redis->lpop($self->id) if $_[0] > $self->buffersi
_[0] eq 'ARRAY' ? $_[0] : [];
$cb->(
grep {$_}
map {my $msg = eval {decode_json $_ }; $@ ? undef : $msg}
@$msgs
);
if ($end == $self->buffersize or @$msgs !=
package App::Alice::Stream;
use JSON;
use Time::HiRes qw/time/;
use Try::Tiny;
use Any::Moose;
use strict;
use warnings;
has queue => (
is => 'rw',
isa => 'ArrayRef[HashRef]',
default => sub
started) {
$output .= "--".$self->seperator."\n";
$self->started(1);
}
$output .= to_json({
queue => $self->queue,
time => time - $self->offset,
}, {utf8 => 1});
$output .=