CPAN-Testers-TailLog
view release on metacpan or search on metacpan
lib/CPAN/Testers/TailLog.pm view on Meta::CPAN
=head2 get_all
Fetches the most recent data possible as an C<ArrayRef> of
L<CPAN::Testers::TailLog::Result>
my $arrayref = $tailer->get_all();
Note that an arrayref will be returned regardless of what happens. It helps to
assume the result is just a dumb transfer.
Though keep in mind non-C<ArrayRef>s may be returned in error conditions
(Undecided).
Calling this multiple times will be efficient using C<If-Modified-Since>
headers where applicable.
Though even if nothing has changed, you'll get a full copy of the last state.
If you want an "only what's changed since last time we checked, see F<examples>
=head2 get_iter
Returns a lazy C<CodeRef> that returns one L<CPAN::Testers::TailLog::Result> at
a time.
my $iter = $tailer->get_iter();
while ( my $item = $iter->() ) {
printf "%s %s\n", $item->grade, $item->filename;
}
As with C<get_all>, present design is mostly "dumb state transfer", so all this
really serves is a possible programming convenience. However, optimisations may
be applied here in future so that C<< $iter->() >> pulls items off the wire as
they arrive, saving you some traffic if you terminate early.
Presently, an early termination only saves you a little disk IO, extra regex
parses and shaves a few object creations.
=head2 url
Accessor for configured log URL.
my $url = $tailer->url;
=head1 SEE ALSO
=over 4
=item * L<P5U::Command::cttail>
Some of the logic of this module shares similarity with the contents of that
module, however, that module is designed as a standalone application that
simply shows the current status with some filtration options.
It is not however designed for re-use.
My objective is different, and I want to write a daemon that periodically polls
for new records, and creates a local database ( Similar to what likely happens
inside C<fast-matrix.cpantesters.org> ) of reports for quick searching, and I
figure this sort of logic can also be useful for somebody who wants a
C<desktop-notification-on-failure> monitor.
Some of the logic was cribbed from this and reduced to be closer to verbatim.
=item * L<fast-matrix tail-log-to-json|https://github.com/eserte/cpan-testers-matrix/blob/master/bin/tail-log-to-json.pl>
C<CPAN::Testers::TailLog> contains similar logic to this script as well, again,
prioritizing for simplicity and re-use.
Any specific mangling with C<distinfo> is left to the consumer.
=back
=head1 AUTHOR
Kent Fredric <kentnl@cpan.org>
=head1 LICENSE
This software is copyright (c) 2016 by Kent Fredric.
This is free software; you can redistribute it and/or modify it under the same
terms as the Perl 5 programming language system itself.
( run in 3.103 seconds using v1.01-cache-2.11-cpan-d06a3f9ecfd )