Test2-Harness
view release on metacpan or search on metacpan
lib/App/Yath/Server/Controller/Stream.pm view on Meta::CPAN
$items = $search_base->search(
$query,
{%$custom_opts, order_by => $order_by}
);
}
while (1) {
my ($item);
if (@buffer) {
$item = $buffer_item;
}
else {
$item = $items->next() or last;
$ord = max($ord || 0, $item->$ord_field);
$update = JSON::PP::false;
if ($track) {
my $id = $item->$id_field;
if (my $old = $incomplete->{$id}) {
$update = JSON::PP::true;
# Nothing has changed, no need to send it.
next if $old->sig eq $item->sig;
}
if ($item->complete) {
delete $incomplete->{$id};
}
else {
$incomplete->{$id} = $item;
}
}
}
unless (@buffer) {
@buffer = $method ? $item->$method : $item->TO_JSON;
$buffer_item = $item;
}
return encode_json({type => $type, update => $update, data => shift(@buffer)}) . "\n";
}
$items = undef;
return;
},
];
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
App::Yath::Server::Controller::Stream - Controller for streaming data that is still being generated.
=head1 DESCRIPTION
=head1 SYNOPSIS
TODO
=head1 SOURCE
The source code repository for Test2-Harness-UI can be found at
F<http://github.com/Test-More/Test2-Harness-UI/>.
=head1 MAINTAINERS
=over 4
=item Chad Granum E<lt>exodist@cpan.orgE<gt>
=back
=head1 AUTHORS
=over 4
=item Chad Granum E<lt>exodist@cpan.orgE<gt>
=back
=head1 COPYRIGHT
Copyright Chad Granum E<lt>exodist7@gmail.comE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
See F<http://dev.perl.org/licenses/>
=cut
=pod
=cut POD NEEDS AUDIT
( run in 0.727 second using v1.01-cache-2.11-cpan-39bf76dae61 )