App-JobLog
view release on metacpan or search on metacpan
lib/App/JobLog/Log.pm view on Meta::CPAN
=head2 all_notes
C<all_notes> processes the log as a stream, extracting all notes and
returning them as an array reference.
=head2 validate
C<validate> makes sure the log contains only valid lines, all events are
in chronological order, and every ending follows a beginning. Invalid lines
are commented out and a warning is emitted. The number of errors found is
returned.
=head2 first_event
C<first_event> returns the first event in the log and the index
of its line. Its return object is an L<App::JobLog::Log::Event>.
=head2 last_ts
Returns last L<DateTime> timestamp in log and the index of this timestamp.
=head2 first_ts
Returns first L<DateTime> timestamp in log.
=head2 last_event
C<last_event> returns the last event in the log and the index
of its line. Its return object is an L<App::JobLog::Log::Event>.
=head2 last_note
Returns most recent note in log and its index, or the empty list if none is found.
=head2 reverse_iterator
C<reverse_iterator> returns a closure that allows you to iterate
over the events in the log in reverse. Every time you call the closure
it returns the next unvisited event.
If you pass this method an optional argument, either a L<DateTime> or a
L<App::JobLog::Log::Event>, it will iterate from the event beginning at or
after this event or time.
=head2 find_events
C<find_events> expects two L<DateTime> objects representing the
termini of an interval. It returns an array reference containing
the portion of all logged events falling within this interval. These
portions are represented as L<App::JobLog::Log::Event> objects.
=head2 find_notes
C<find_notes> expects two L<DateTime> objects representing the
termini of an interval. It returns an array reference containing
the portion of all logged notes falling within this interval. These
portions are represented as L<App::JobLog::Log::Note> objects.
=head2 find_previous
C<find_previous> looks for the logged event previous to a given
moment, returning the L<App::JobLog::Log::Event> objects and the
appropriate log line number, or the empty list if no such
event exists. It expects a L<DateTime> object as its parameter.
=head2 find_previous
C<find_previous> looks for the logged event previous to a given
moment, returning the L<App::JobLog::Log::Event> objects and the
appropriate log line number, or the empty list if no such
event exists. It expects a L<DateTime> object as its parameter.
=head2 append_event
C<append_event> expects an array of event properties. It constructs an event
object and appends its stringification to the log, returning a L<DateTime::Duration>
object if the previous event was left open and spanned more than one day.
=head2 append_note
Takes a description and a set of tags and appends it to the log as a note with the
current timestamp.
=head2 close
C<close> closes the L<IO::All> object, if it exists and is open, forcing
all content to be written to the log.
=head2 insert
C<insert> takes an insertion index and a list of L<App::JobLog::Log::Line> objects
and inserts the latter into the log at the index preceded by a comment explaining
that these lines have been inserted.
=head2 replace
Replace one line with another.
=head1 AUTHOR
David F. Houghton <dfhoughton@gmail.com>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by David F. Houghton.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
( run in 1.979 second using v1.01-cache-2.11-cpan-39bf76dae61 )