
App::TimeTracker::Task - interface to one task

my $task = App::TimeTracker::Task->new({
start => '1232010055',
project => 'TimeTracker',
tags => \@tags,
basedir =>'/path/to/basedir',
});
$task->stop_it;
$task->write( );
my $task = App::TimeTracker::Task->read('/path/to/file');
say $task->start; # epoche
say $task->is_active; # 1 or 0
say $task->duration; # in seconds

my $task = App::TimeTracker::App->new( $data );
Initiate a new task object.
$self->stop_it;
$self->stop_it( $dt );
Stop this task, either at the specified $epoche, or now(). Throws an exception if the task is already stopped.
Returns $self for method chaining.
my $task = App::TimeTracker::Task->read( $path );
Reads the specified file, parses it, generates a new object and returns the object.
$task->write; $task->write( $basedir );
Serialises the data and writes it to disk.
If you got the object via read, you don't need to specifiy the $basedir. If this is the first time you want to write the object, the $basedir is neccesary.
$task->set_current;
Makes $task the current task
my $current = App::TimeTracker::Task->get_current( $basedir );
Loads the current task (i.e. the one you're working on ATM). Returns undef if there is no current task.
$self->remove_current;
Removes the current task file (because it's no longer current, but done).
remove the suspendend file. NOT IMPLEMENTED YET
Stops the current task
my $string = $self->get_printable_interval([$start, stop]);
Returns a string like "worked 30 minutes, 23 seconds on Task (foo bar)"
my $nice_message = $self->beautify_duration($duration);
Turns an DateTime::Duration object into a nicer representation ("4 minutes, 31 seconds")
my $nice_message = $self->beautify_seconds($seconds);
Turns an amount of seconds into a nicer representation ("4 minutes, 31 seconds")
say $task->nice_tags;
Pretty-print the tag list
Returns true if the task is active, undef if it isn't

Thomas Klausner, <domm at cpan.org>

Copyright 2008, 2009 Thomas Klausner, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.