App-Alice
view release on metacpan or search on metacpan
lib/App/Alice/HTTPD.pm view on Meta::CPAN
$res->content_type('text/plain');
$res->content_length(2);
$res->body('ok');
return $res->finalize;
}
sub send_index {
my ($self, $req) = @_;
return sub {
my $respond = shift;
my $writer = $respond->([200, ["Content-type" => "text/html; charset=utf-8"]]);
my @windows = $self->app->sorted_windows;
@windows > 1 ? $windows[1]->{active} = 1 : $windows[0]->{active} = 1;
$writer->write(encode_utf8 $self->app->render('index_head', @windows));
$self->send_windows($writer, sub {
$writer->write(encode_utf8 $self->app->render('index_footer', @windows));
$writer->close;
delete $_->{active} for @windows;
}, @windows);
}
}
lib/App/Alice/Stream.pm view on Meta::CPAN
is => 'ro',
default => 1024,
);
sub BUILD {
my $self = shift;
my $local_time = time;
my $remote_time = $self->start_time || $local_time;
$self->offset($local_time - $remote_time);
my $writer = $self->writer->(
[200, ['Content-Type' => 'multipart/mixed; boundary='.$self->seperator.'; charset=utf-8']]
);
$self->writer($writer);
$self->_send;
}
sub _send {
my $self = shift;
try { $self->send }
catch { $self->close };
}
share/static/alice.js view on Meta::CPAN
setRequestHeaders: function() {
var headers = {
'X-Requested-With': 'XMLHttpRequest',
'X-Prototype-Version': Prototype.Version,
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
};
if (this.method == 'post') {
headers['Content-type'] = this.options.contentType +
(this.options.encoding ? '; charset=' + this.options.encoding : '');
/* Force "Connection: close" for older Mozilla browsers to work
* around a bug where XMLHttpRequest sends an incorrect
* Content-length header. See Mozilla Bugzilla #246651.
*/
if (this.transport.overrideMimeType &&
(navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
headers['Connection'] = 'close';
}
( run in 0.245 second using v1.01-cache-2.11-cpan-4d50c553e7e )