App::JobLog::Log - the code that lets us interact with the log
version 1.036
App::JobLog::Log uses an IO::All object to extract information from the log file or add lines to it.
App::JobLog::Log
This wasn't written to be used outside of App::JobLog. The code itself contains interlinear comments if you want the details.
App::JobLog
new is the constructor, naturally. It touches the log file into existence if it does not yet exist, initializing the hidden job log directory in the process, which means creating the directory and the README file. It also opens an IO::All object to read or modify the log with.
new
all_taglines returns a list of all lines in the log that may have tags.
all_taglines
all_events processes the log as a stream, extracting all events and returning them as an array reference.
all_events
all_notes processes the log as a stream, extracting all notes and returning them as an array reference.
all_notes
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.
validate
first_event returns the first event in the log and the index of its line. Its return object is an App::JobLog::Log::Event.
first_event
Returns last DateTime timestamp in log and the index of this timestamp.
Returns first DateTime timestamp in log.
last_event returns the last event in the log and the index of its line. Its return object is an App::JobLog::Log::Event.
last_event
Returns most recent note in log and its index, or the empty list if none is found.
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.
reverse_iterator
If you pass this method an optional argument, either a DateTime or a App::JobLog::Log::Event, it will iterate from the event beginning at or after this event or time.
find_events expects two 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 App::JobLog::Log::Event objects.
find_events
find_notes expects two 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 App::JobLog::Log::Note objects.
find_notes
find_previous looks for the logged event previous to a given moment, returning the App::JobLog::Log::Event objects and the appropriate log line number, or the empty list if no such event exists. It expects a DateTime object as its parameter.
find_previous
append_event expects an array of event properties. It constructs an event object and appends its stringification to the log, returning a DateTime::Duration object if the previous event was left open and spanned more than one day.
append_event
Takes a description and a set of tags and appends it to the log as a note with the current timestamp.
close closes the IO::All object, if it exists and is open, forcing all content to be written to the log.
close
insert takes an insertion index and a list of 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.
insert
Replace one line with another.
David F. Houghton <dfhoughton@gmail.com>
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.
To install App::JobLog, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::JobLog
CPAN shell
perl -MCPAN -e shell install App::JobLog
For more information on module installation, please visit the detailed CPAN module installation guide.